I did some benchmarks comparing performance of int vs Integer, long vs Long, empty class instance vs class instance with long value.
And I have few questions which I cannot answer myself:
I used JDK1.6.0_30 on MacOS, and the code is available at https://github.com/mousator/benchmarks/blob/master/src/sk/emandem/michal/AutoboxingTypeBenchmark.java (you can checkout the whole project)
Thanks for answers!
runtime.gc()
doesn't necessarily do anything. Use a tool like MemoryMeasurer.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With