|
|
|
|
|
by bartread
2243 days ago
|
|
I see people doing this crap all the time in the middle of tight loops that do a lot of work in C#, JS, TypeScript, and justifying it on the grounds of "productivity" and "readability". It seriously gets on my nerves. Do not do this. Functional code might look nice but often creates excess work for the GC and kills performance. We had a situation within the last week where a piece of code was blowing through 350MB of memory unnecessarily, and massively slowing down a heavy set of calculations, because of exactly this kind of issue. |
|
On the contrary, please do this. "productivity" and "readability" are important aspects to consider when writing code, especially if someone else is going to be reading it.
When you've identified a bottleneck, feel free to write the code in the bottleneck more performantly, if necessary. But please do not sacrifice readability across the entire codebase for a couple of hot loops.