Jump to content
View in the app

A better way to browse. Learn more.

RDR2Mods.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[SOLVED] Performance question: std::map vs. struct

Featured Replies

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 by HughJanus

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.

  • HughJanus changed the title to [SOLVED] Performance question: std::map vs. struct

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.