HughJanus 244 Posted January 2, 2022 Share Posted January 2, 2022 (edited) So SAC and I were discussing performance and pretty code via DM and the question came up wheter a lot of maps or a single map filled with structs with lots of attributes would be more performant. Since we didnt know, I wanted to search some knowledge here. Will a script be more performant if I use e.g. 100 std::maps to store and retrieve information for 1000 keys or one single map filled with 1000 keys, each value being a struct with 100 attributes? Edited January 3, 2022 by HughJanus Quote Link to comment Share on other sites More sharing options...
LMS 674 Posted January 2, 2022 Share Posted January 2, 2022 Let me preface my reply by saying that it is irrelevant in comparison to the performance cost of other operations, such as making native calls. However, the cost of performing map lookup in comparison with a dereferencing a pointer is a lot greater, so a single map with lots of values would be faster. But again, we are talking infinitesimal differences. The degree of organization a single map provides is also worth a lot. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.