Question

I have a function that gets a collection by reference, iterates over it, constructs a new collection of the same length containing updated structs, returns that collection (or rather a reference to it, since it's Boo/C# code).

I'm worried about performance of such a function. Is performance a lot worse than just updating the collection by reference? I need to call this function tens of times per second.

Thank you. Alisa.

P.S.: Why am I doing this? I'm trying to move onto functional programming and make it as pure as possible.

Was it helpful?

Solution

It will be slower, but not by much. It will also consume more memory as you'll have two collections in RAM whenever you're updating the structs.

The impact on performance will also be affected by your collections' sizes.

The best way to answer your question is to create both functions, then profile them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top