Hacker News new | past | comments | ask | show | jobs | submit login

The way these are implemented, the short answer is yes. There will be more memory pressure on the garbage collector in Scala. The long answer is, "mmmm maybe, you should test it" because due to escape analysis, eden generation collecting speed, JIT, etc. It can get very complicated very fast. It can also be very dependent on what you mean by "significant penalty" and "performance".

As an aside, Scala does allow for compile time only small types in the form of AnyVal's. They won't help in the examples in the article, but in the simpler kilogram wrapper around float it will and there will be no performance penalty as it will be elided by the compiler.




Or to reuse an adage: "It's easier to optimize correct code than to correct optimized code."

You can always find the slow part and change it to use raw floats/ints/etc.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: