1
0
mirror of synced 2024-11-27 17:10:51 +01:00
ImHex/plugins/script_loader/source
Shubhankar Sarangi 4fcf732814
impr: Reserve space to avoid multiple allocations when loading scripts (#1929)
std::forward ensures that the arguments are perfectly forwarded to
loadScript
By reserving space in the features vector based on the size of scripts,
we can avoid multiple memory allocations during the loop. If an
exception occurs, returning an empty vector immediately clarifies that
no scripts were loaded. Without reservation, each call to emplace_back
could potentially trigger a reallocation if the current capacity is
exceeded, which is costly in terms of performance. This leads to more
efficient memory management and can significantly speed up the execution
time when dealing with a large number of scripts.


![image](https://github.com/user-attachments/assets/3e290162-fb8b-4f00-a71b-6009494b2dab)
2024-11-24 11:28:45 +01:00
..
loaders/dotnet impr: Added nicer console warning when .NET runtime isn't installed 2024-07-02 23:15:54 +02:00
plugin_script_loader.cpp impr: Reserve space to avoid multiple allocations when loading scripts (#1929) 2024-11-24 11:28:45 +01:00