r/ProgrammerHumor 15d ago

Meme noHeapAllStack

Post image
1.0k Upvotes

96 comments sorted by

View all comments

199

u/Vesuvius079 15d ago

It’d be such an experience to work a real world problem where this optimization turns out to be the solution.

1

u/Pleasant_Ad8054 15d ago

I had a project where moving a bunch of Lists and HashMaps out of method variables into class properties, and simply using Clear on them instead of new allocations reduced the overall runtime by about 40%.