cactoos: SolidScalar is slow

SolidScalar uses syncronized access to cached value, that is not really fast in comparation with mutable volatile fields (~ 50 times faster). I created an app to prove this: https://github.com/g4s8/synctest I compared SolidScalar vs double check + volatile scalar and got these results for 10_000_000 executions on 17 threads: (values are average of per vallue() execution) SolidScalar - 2400 - 3200 nano-seconds double-check scalar - 58 - 61 nano-seconds

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (10 by maintainers)

Commits related to this issue

Most upvoted comments

@llorllale yes, sorry for that, will update the ticket