PurpleKingdomGames / indigo

An FP game engine for Scala.
https://indigoengine.io/
MIT License
613 stars 56 forks source link

Batch performance suggestions #687

Open davesmith00000 opened 5 months ago

davesmith00000 commented 5 months ago

You might get a quick and easy performance boost by making it a sealed abstract class instead of a sealed trait. That would make the access to the private lazy val monomorphic.

So says @sjrd.

Try it. Benchmark it. Sounds like a fun task to me. :)

davesmith00000 commented 4 months ago

Benchmarks, before:

image

image

davesmith00000 commented 4 months ago

Benchmarks, after:

image

image

davesmith00000 commented 4 months ago

I'm calling that inconclusive. I'll have to re-run with more iterations to get more stable numbers. Notice that List is jumping about and it shouldn't be.