top | item 23084738

(no title)

negativegate | 5 years ago

PixiJS is the only one to reach above 100 FPS on my desktop, though that's inbetween frequent GC pauses. Two.js gets ~70 and Paper.js gets ~48.

There would probably be less GC pauses if the benchmark code wasn't doing things like

  [...Array(this.count.value).keys()].forEach(...)
instead of a for loop.

discuss

order

bartread|5 years 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.

johnfn|5 years ago

> ustifying it on the grounds of "productivity" and "readability". It seriously gets on my nerves. Do not do this.

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.

Aeolun|5 years ago

Is that really readable? I may be a crusty old fart, but that kind of shit is the antithesis of readable to me.

gnykka|5 years ago

I made a change to loops to use for() cycle, thanks

gnykka|5 years ago

Good point. Usually I like to use map or reduce for arrays but here simple for is easier.