❔ Separating struct array data

Is it worth separating fields of array data (struct array) into different data structures so that cache hit count increases? Because the struct size reduces and more elements of the array can be cached When I say separation I mean smart separation (relevant data in a struct)
I don't think there's enough information to say much I'm afraid. It probably all comes down to usage patterns: if you're accessing the fields together, having them together in cache is a good thing; if you're accessing elements in turn and not jumping around a lot, it probably doesn't matter that the array is being loaded into cache a chunk at a time. Get a profiler out and see for yourself, with your usage patterns
Yes, thanks and another question, if I have a 3d array, it can detect the access pattern to cache elements? I mean, it does not matter if I loop over i,j,k or k,j,i ?
It probably will. A multidimensional array is just a flat array, and it does the maths to work out which element corresponds to a particular i,j,k
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Looking for more? Join the community!

Want results from more Discord servers?
Add your server
Recommended Posts
❔ class instance creationcan any one tell me what is this method to create an instance of a class 1--> Product product = new(Turning an Event into a Task [Answered]I have a method that needs to send a message over the network, and then wait for a response before r❔ EF Core duplicating many-to-many?After saving, the references are duplicated! ```cs var entityShowcase = new Models.ShowcasOnly one compilation unit can have top-level statements. [Project]csharp(CS8802) [Answered]I want to make my code cleaner by making different files. But when i make different files i get this❔ ASP.NET Core ignore a specific warning by IDA library that I'm using makes Kestrel produce a warning with a specific id. Is there a way to supprEntity Framework Migration CreationHi, so I know migrations created are based on DBContext. But how can I create a migration for a mode❔ Invalid input in memuHere is the updated code, how would i make it if the user enters a invalid input it will show the me❔ check if string is valid guid without guid.TryParseas in title, i would like to avoid conditions like `if (!Guid.TryParse(string, out var _))`, instead❔ .NET CORE 6 servicesSo i want add a service "AddContentful" but idk how to fix this because i can only find configuratio❔ Console Game Project (Memory Matching)Hi all! I'm not sure if this is the right channel, but I have a question... I'm New to programming (Find all HREFs out of string and extract valueHey, I am currently developing a web scraper and therefore want to extract all available information❔ How to store session data backend?I'm building a similar game to skribbl.io which is a drawing game where you draw with other people. ❔ How do i sort a list of objects by multiple possible itemsHey, i'm trying to write a method to return a list of objects by letting the user choose which item ❔ ASP.NET Core how to let a controller be mapped only in development modeThis is pretty easy to do with minimal API's, you just do a check and map only if it succeeds: ```cs