7 ms·
JVM Anatomy Quarks
- ajkjk 7y agoThis is good stuff. I wish it existed for a lot of other things -- like python and v8. Or maybe it does? Where can I find deep technical knowledge in bite-size form?
- shortercode 7y agoWhile not quite the same the V8 team has a blog that discusses various improvements they are making. Such as the Orinoco GC project. Which typically contains some details on the implementation. It's a fairly fascinating window into the inner workings, and quite detailed. https://v8.dev/blog https://v8.dev/blog
- jashmatthews 7y agoThe WebKit blog also has really good info on JSC E.g. https://webkit.org/blog/7122/introducing-riptide-webkits-retreating-wavefront-concurrent-garbage-collector/ https://webkit.org/blog/7122/introducing-riptide-webkits-ret... Filip Pizlo’s site has a bunch of his presentations of how their JIT compiler works http://www.filpizlo.com/papers.html http://www.filpizlo.com/papers.html
- simula67 7y agoFor Python, there is a code walkthrough by Philip Guo : https://www.youtube.com/playlist?list=PLzV58Zm8FuBL6OAv1Yu6AwXZrnsFbbR0S https://www.youtube.com/playlist?list=PLzV58Zm8FuBL6OAv1Yu6A...
- emmanueloga_ 7y agohttps://mrale.ph/ https://mrale.ph/ had quite a few deep dives on JS/v8, not sure how up to date it is now
- fctorial 7y agoThere doesn't need to be. These VMs aren't designed to run anything other than their flagship languages.
- ryeguy 7y agoI'm not sure where you're getting that idea. Are you thinking the target audience of this content is only for people developing JVM languages? It's not, it's how the vm and compiler work at a low level and optimize your code.
- xxs 7y agoMost of the stuff is quite old, 1.6/1.7 times, though. It should be appreciated, it has been gathered in a single place and backed up with micro benchmarks and assembly.
- wiradikusuma 7y agoMan, I always use String.intern() for synchronized(theString). -- https://shipilev.net/jvm/anatomy-quarks/10-string-intern/ https://shipilev.net/jvm/anatomy-quarks/10-string-intern/
- aardvark179 7y agoI hesitate to ask what exactly you’re trying to achieve locking On a string which you have to intern like that. There may well be a different design that would avoid having to do it.
- deleted 7y ago[deleted]
- diroussel 7y agoIf need to synchronise() and there is not an obvious choice then I create a new Object() for that purpose and make sure it’s available wherever locking is needed (ideally encapsulated in one class)
- sorokod 7y agoThe ReentrantLock class and friends have been around for a while and typically provide a better alternative.
- xxs 7y agoNowadays (java 7/8), "synchronize" is likely better than most uses of reentrant lock, though. It's especially good in (common) cases where the lock is not contended. even CHM uses synchronized nowadays. Flip note: don't touch ReadWriteLocks
- sorokod 7y ago> don't touch ReadWriteLocks I am interested in references that back this statement
- jnordwick 7y agoI have been reading Aleksey Shipilev for a decade now, and his insight in high performance Java was been a well worth the time. He is also the maintainer of JMH, Java Microbenchmarking Harness, a tool I miss in about every other language especially Go. Because writing microbenchmarks is really difficult especially on a JIT that wants to rewritw and optimize things behind your back a couple times. Hotspot can be both brilliant and maddening. Thanks to much of his writings and the rest of the Java performance community (pretty large in the fintech sector), I can write faster Java than most people can with C++. It just takes some effort, but the control and performance you can get from Java is really impressive. I've had to deep dive into Go a little more lately, and I really miss some of the Java support. I've found Go to be much slower when you have to do anything interesting. In high performance Java you often rewrite a lot of the base libraries in a very different style that gives you tight control over escape analysis, GC, call site inlining, etc. You actually have a decent amount of control for such a high-level language. In Go, I haven't been able to find that control. The Go team seems to have taken an opposite approach and removed your control (I often joke about Go just being short for "Go Fuck Yourself" because of its attitude against developer control and the teams's "if we don't need it you don't need it" attitude). It is resources like this that really make Java shine in its pro high performance developer attitude. (Current Go issue, getting select and channels to operate anywhere remotely efficiently and trying to find a way to keep high CPU goroutines on different OS threads - so far not much luck).
- closeparen 7y agoBenchmarking and profiling are both built into the language, which is pretty nice. But you’re right, Go is designed for safety over control. High performance Go comes down to avoiding allocations; there’s not too much else you can do at the language level.
- deleted 7y ago[deleted]
- jnordwick 7y agoNot sure if you can even control GCs that well some times. In Java I've worked on projects that never GC once they reach a steady state. I'm not sure I could do the same in Go, or maybe the techniques are just more involved or different?
- deleted 7y ago[deleted]
- MaxBarraclough 7y agoI'm not getting #17: Trust Nonstatic Final Fields. > what happens if someone changes that field? The field is final. The static is final. How can the field be changed? Reflection?
- UncleMeat 7y agoFinal applies to the field, not the object. You can still mutate the object pointed at by a final field.
- MaxBarraclough 7y agoSure, but the instance's only field, is final. The static reference KNOWN_M is final, and the only field of the pointed-to instance, x, is also final.