2017-03-09 12:34 GMT+01:00 'bertschi' via Clojure <
clo...@googlegroups.com>:
> Thanks for your comments. As suggested I ran a small benchmark of both
> versions. Turns out that the difference between (ref-set ref @ref) and
> ensure is huge ...
> I'm running clojure 1.8.0 by the way. According to VisualVM the (ref-set ref @ref) version spends most of its time in clojure.lang.LockingTransaction$RetryEx.<init> () while ensure gets basically stuck (> 99%) at clojure.lang.LockingTransaction.tryWriteLock ().
On my machine, results don't look as bad, but ensure still has a
significantly worse bad case (the upper quantile), the best case
(lower quantile) is about on par with ref-set.
Disabling tiered compilation helps close the gap (possibly due to lock
straightening?) but ref-set still comes out ahead.
The tests run significantly faster on server compilation than on
tiered compilation and also run faster on clojure-1.9.0-alpha14, than
on -1.8.0
I'm on % java -version
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (build 1.8.0_121-13)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)
Here is a gist with my test program + output listings:
https://gist.github.com/bendlas/6e3b24bb639c248fdc47d192f5117c39
cc clojure-dev:
is this ready for a ticket? do we need any more information to show
what's going on?