3 ms·
Which version of Java are you using? And what is Rnd? The class included with JDK is Random. We rely on escape analysis to elide such object creation for us and
by hawk_ 6y ago
Which version of Java are you using? And what is Rnd? The class included with JDK is Random. We rely on escape analysis to elide such object creation for us and it works reasonably well. If something this trivial doesn't work for you, file bug with them. We have had success with that as well.
- bluestreak 6y agoThis ran on Java 11. This isn't so much of an issue for us. We are trying to avoid allocations, even as trivial as those. There are other examples that allocated where they should not, for example this lambda will allocate. () -> System.out.println(1) I lost hope in escape analysis quite frankly. Rnd is something I have written because Java's Random is slow and clunky. https://github.com/questdb/questdb/blob/master/core/src/main/java/io/questdb/std/Rnd.java https://github.com/questdb/questdb/blob/master/core/src/main...
- pjmlp 6y agoEscape analysis is very JVM implementation specific, but inline classes should finally sort it out.