Hacker News new | ask | show | jobs
by brodo 4708 days ago
Scala creates a ton of little objects? Are you aware that primitive types are only converted to objects in Scala, if they are used as objects?
1 comments

Sure but every anonymous function call creates new objects, as do each call to the collections library methods (often many objects), for comprehensions, tuple creation, lazy vals, pattern matching, futures, options etc. all create objects.

If you are programming in a functional paradigm you will be throwing off garbage, often when you wouldn't expect to from a cursory glance at the code.

You can mitigate it, but often to do so you have to resort to writing scala as java (which is still better than java as java).