<https://gist.github.com/tateisu/be6cdaee0a4e28186...
# announcements
t
https://gist.github.com/tateisu/be6cdaee0a4e28186090fb3834899788 A quick speed comparison for
apply {…}
. Why three times slower ?
q
That's not it because the lambda for apply is inlined. @tateisu Can you try a JMH run?
d
You're not taking into account jvm warmup.
t
There was almost no difference in the measurement using JMH.
Copy code
Benchmark       Mode  Cnt          Score         Error  Units
Test1.usePutA  thrpt    5  198647812.122 ± 5274224.588  ops/s
Test1.usePutB  thrpt    5  199240159.796 ± 3084180.600  ops/s
q
@tateisu send JMH code?
q
Surprising indeed. Maybe the extra variables have something to do with it. Can you try replacing the value with an actual HashMap?
t
Copy code
Benchmark               Mode  Cnt          Score         Error  Units
Test1.Assign_usePutA   thrpt    5  203400407.487 ± 2865226.203  ops/s
Test1.Assign_usePutB   thrpt    5  204155138.678 ± 3377144.700  ops/s
Test1.HashMap_usePutA  thrpt    5  178620434.808 ± 1841608.980  ops/s
Test1.HashMap_usePutB  thrpt    5  179397964.384 ± 2171024.588  ops/s