Re: Unnecessary boxing of return from set!

2022-05-15 Thread 'Alex Miller' via Clojure
I don't think that void type hint is going to do anything there. The deftype impl of apply here will (has to by Java requirements) return void here. There is a gap here I think where the return gets needlessly boxed. You might try just putting a nil expr after the set! as a workaround. In any

Re: Unnecessary boxing of return from set!

2022-05-15 Thread pete windle
I wondered if this would work if I handed the result off to a helper class public class VoidHelper { public static void voidLong(long x) {} } If this somehow improved the code path, with inlining etc it would be basically free. ...but the generated code gets worse. public void

Re: Unnecessary boxing of return from set!

2022-05-15 Thread pete windle
Definitely in the same wheelhouse, but upgrading to 1.11.1 shows the same behaviour - as expected, because this is not an InstanceMethodExpr. https://github.com/clojure/clojure/blame/master/src/jvm/clojure/lang/Compiler.java#L1831-L1842 is the logic for StaticMethodExpr. AssignExpr hands off

Re: Unnecessary boxing of return from set!

2022-05-15 Thread Erik Assum
This reminds me of a bug that I believe Ghadi fixed for 1.11, https://clojure.atlassian.net/browse/CLJ-2621 Don’t know if that helps much, though. Erik. -- i farta > 15. mai 2022 kl. 14:11 skrev pete windle : > > Hey, I'm trying to work on some performance sensitive code using Clojure >

Unnecessary boxing of return from set!

2022-05-15 Thread pete windle
Hey, I'm trying to work on some performance sensitive code using Clojure together with the Carrotsearch HPPC library. I've come up against a weird behaviour of set! in conjunction with primitive maths. This example is a toy problem not a production problem, but there are things I might not be