News for hackers. Stuff that matters.
Re:Quick Tips for Fast Code on the JVM by gravypod on Sunday December 31, 2017 @08:14AM (#16040462)
I'd actually like to add "Don't touch synchronized functions" to the list. If need be try and use Thread Locals instead.
Re:Quick Tips for Fast Code on the JVM by imhoguy on Sunday December 31, 2017 @08:34AM (#16040509)
Foremost one should look what java.util.concurrent[0] has to offer before reinventing concurrency patterns from scratch.

[0] https://docs.oracle.com/javase/9/docs/api/java/util/concurre...

Re:Quick Tips for Fast Code on the JVM by aardvark179 on Sunday December 31, 2017 @10:30AM (#16040911)
I’ve seen statements like this before, and they are often based on misunderstandings of what either monitors (synchronisation) or ThreadLocal give you. Could you maybe expand your comment to describe what problem with synchronised you would suggest fixing using ThreadLocal?
Re:Quick Tips for Fast Code on the JVM by dboreham on Sunday December 31, 2017 @01:35PM (#16041915)
Please avoid TLS at all costs unless you really know what you are doing and why. It can blow up GC due to the reference graph becoming highly interconnected via the TLS arrays. This can happen without you being aware because dependent libraries are busy being oh so clever with TLS.
Re:Quick Tips for Fast Code on the JVM by lamansion on Sunday December 31, 2017 @06:44PM (#16043697)
I don't think this is good advice. If you need synchronization use sych. primitives, java.util.concurrent etc., not thread locals.
Re:Quick Tips for Fast Code on the JVM by sorokod on Sunday December 31, 2017 @01:21PM (#16041824)
Don't think ThreadLocals help when you actually need to share state between threads.