tag:blogger.com,1999:blog-4704664917418794835.post681101033932402497..comments2023-07-01T05:41:30.469-07:00Comments on Headius: On Languages, VMs, Optimization, and the Way of the Worldheadiushttp://www.blogger.com/profile/15717357218364947795noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-4704664917418794835.post-74874318888611966852013-09-08T19:06:31.296-07:002013-09-08T19:06:31.296-07:00Recently tried Go, a statically typed language des...Recently tried Go, a statically typed language designed to scale.<br /><br />Because the language is so simple and familiar it's very easy to pick up and doesn't feel too far off the ease of a dynamic language .<br /><br />Wonder if it will pick up Ruby and Python users wanting speed. Read a recent article where it was said it could likely replace java .<br /><br />There's a certain comfort in static languages, better error reporting but usually too much boilerplate code. That's where it's fun to use Ruby and a bit of a shame Rubinius has stalled, would have been good to see how it compared in your comparisons.Anonymoushttps://www.blogger.com/profile/12416331371597362794noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-84797914798732109272013-08-04T21:23:05.197-07:002013-08-04T21:23:05.197-07:00I have been writing Java for 10 years and Dart for...I have been writing Java for 10 years and Dart for 6 months. <br /><br />I find the benchmark is not fair!<br />This is executed 100,000 times. Making Java do at least 800,000 object creations and 400,000 array copies more.<br />for (int i = 0; i < n; i++) {<br /> src = new Variable("src", i);<br /> dst = new Variable("dst", i);<br />Java:<br />for (int i= 0; i < n; ++i) {<br /> src= new Variable("src" + Integer.toString(i), i);<br /> dst= new Variable("dst" + Integer.toString(i), i);<br /><br />Java has threading and shared state.<br />Dart has isolates.<br />Dart has no Java Native Interface Equivalent, locks, threading, thread affinity, mmap, etc.<br /><br />Alot of good blog posts about low level Java and how it has taken over Low Latency High Frequency Trading World here:<br />http://vanillajava.blogspot.com/<br /><br />Some system are now moving to a Disruptor model. Outlined in this paper:<br />http://lmax-exchange.github.io/disruptor/files/Disruptor-1.0.pdf<br />Impossible to do with Dart.<br /><br />What you can do with Dart is write JavaScript. That is what I use it for. It really needs to focus on getting into the browser to replace Flash/Java/JavaScript for web games.Anonymoushttps://www.blogger.com/profile/17545363893176655677noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-58267086059701837222013-08-04T18:34:21.124-07:002013-08-04T18:34:21.124-07:00It's not just about speed, John Carmack talks ...It's not just about speed, John Carmack talks about static typing in his 2013 keynote (part 4 on youtube) summary link: http://lavinski.tumblr.com/post/57214532454/john-carmack-keynoteAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-50042376646352448122013-07-29T13:48:12.134-07:002013-07-29T13:48:12.134-07:00Apparently you can come close, with things like ps...Apparently you can come close, with things like psyco/pypy, V8, clojure (though statically typed), asm.js (though statically typed, it's built on javascript)...<br />Cheers!<br />-roger-Roger Packhttps://www.blogger.com/profile/01578246846716577925noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-85136632020963736612013-06-04T00:03:07.509-07:002013-06-04T00:03:07.509-07:00Great post, You hit the nail on the head! I would ...Great post, You hit the nail on the head! I would like to add one point about the object layout. Cpu usage is not the only possible bottleneck with regards to performance, but memory usage can as well become a bottleneck. Without a predictable object layout, you will need more indirections, which will increase memory usage. Just one data point, WebOS was known to have issues with the memory usage,of their Javascript based applications. <br />Regards Markus Anonymoushttps://www.blogger.com/profile/06348916709650836506noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-7524306515688245162013-05-25T20:09:26.088-07:002013-05-25T20:09:26.088-07:00This sounds a lot like the behavior that tools lik...This sounds a lot like the behavior that tools like ASM.JS enable for JavaScript. With ASM.JS you mark a block of valid JavaScript as conforming to the ASM.JS type system and that the block should not contain surprises and after some checks the run-time can highly optimize that code section (with ASM.JS claiming within 2X native performance).<br /><br />ASM.JS takes the idea to an extreme by trying to be a compiler target subset of JavaScript as opposed to easily human readable source, but it does enable a target for DSLs such as C with Emscripten (if you let me call C/C++ a DSL in the context of executing C/C++ code within JavaScript :P).rajsitehttps://www.blogger.com/profile/05418973402615021841noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-5936509202589038912013-05-17T22:17:01.161-07:002013-05-17T22:17:01.161-07:00Nikolay: The problem is not that one thread would ...Nikolay: The problem is not that one thread would need access to another's stack statte. The problem is that both threads are running the same code at the same time. You can't just arbitrarily rewrite that code to do something new if there are other threads running it, but that's the cornerstone of how PyPy does its deoptimization/reoptimization. A couple safe ways to do it would be to either have the current code branch into *new* code, which would generally require fixing up the stack and registers, or have all threads periodically check whether they should escape the current code in case it gets deoptimized or modified. At the moment, I'm not sure what the PyPy folks are planning to do.headiushttps://www.blogger.com/profile/15717357218364947795noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-58678241756161489732013-05-17T22:13:20.289-07:002013-05-17T22:13:20.289-07:00Great post, thanks for sharing. One quick question...Great post, thanks for sharing. One quick question: I am not sure what you mean when you say that PyPy's approach to dealing with stack frames hurts parallelism - under what circumstances (other than debugging) would one thread really need to access another thread's stack state (that has not been moved to the heap yet)?Nikolayhttps://bonovox.be/blog/noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-73988902272988471072013-05-13T09:22:47.890-07:002013-05-13T09:22:47.890-07:00Anonymous: I'm not sure what point you're ...Anonymous: I'm not sure what point you're trying to make.<br /><br />Is it that V8 performs better than some systems with predictable type and object structures that had fewer or less capable engineering resources on hand? That hardly seems like a realization.<br /><br />Is it that systems without predictable type and object structures can still be optimized well? I think I said as much during my post.<br /><br />Unknown: First off, I wouldn't say "leap ahead" is true at all. It was a bit faster on the stock version of this benchmark...in the neighborhood of 10-15%.<br /><br />WRT your two feature questions...it depends on the JVM. I know Hotspot's (OpenJDK's) capabilities reasonably well, so I'll answer based on that.<br /><br />1. Hotspot will inline up to 2 targets. Past that, the site is considered polymorphic and Hotspot will use other mechanisms to optimize the dispatch...but not inlining (I'm not sure if it still inlines the hot two targets).<br /><br />2. Hotspot has a fairly limited escape analyzer that works only when all paths through code can be followed. In other words, if there's any branch that's not followed during profiling or any method that doesn't get inlined, objects that *might* flow along those paths cannot be escape-analyzed away. This is probably the biggest issue for Hotspot right now.headiushttps://www.blogger.com/profile/15717357218364947795noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-65106293089465930972013-05-13T02:28:08.828-07:002013-05-13T02:28:08.828-07:00Does JVM performs those optimizations ? :
1. poli...Does JVM performs those optimizations ? :<br /><br />1. polimorphic inlining - https://codereview.chromium.org/14740005 - for deltablue benchmark http://www.dartlang.org/performance/<br /><br />This is are probable cause of recent improvements in dart vm that made it leap ahead of jvm on deltablue benchmark.<br /><br />2. allocation sinking - https://codereview.chromium.org/14935005/ - http://wiki.luajit.org/Allocation-Sinking-Optimization - for tracer benchmark http://www.dartlang.org/performance/<br /><br />It would be interesting to jvm vs dartvm on tracer...<br />tawekhttps://www.blogger.com/profile/09338082072981742469noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-5723476600904174182013-05-11T13:46:42.001-07:002013-05-11T13:46:42.001-07:00Ruby and JavaScript are dynamically typed and type...<b>Ruby and JavaScript are dynamically typed and types and objects can change shape at runtime. This is a confluence of all the hardest-to-optimize language characteristics. In both cases, the best we can do is to attempt to predict common type and object shapes and insert guards for when we're wrong, but it's not possible to achieve the performance of a system with fully-predictable type and object shapes. Prove me wrong.</b><br /><br />It's not possible to achieve the MAXIMUM ACHIEVABLE performance of a system with fully-predictable type and object shapes.<br /><br />Because V8 Javascript sure beats the crap out of lots and lots of systems with "fully-predictable type and object shapes" -- just because those systems didn't have the engineering talent and optimizations that it had.<br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-89312422952321466122013-05-11T13:29:48.537-07:002013-05-11T13:29:48.537-07:00How does Rust compare, in your view? www.rust-lan...How does Rust compare, in your view? www.rust-lang.orgvruzhttps://www.blogger.com/profile/11542801096583121265noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-19516729887149514132013-05-11T06:49:12.698-07:002013-05-11T06:49:12.698-07:00@anthonybailey.net This would certainly count as &...@anthonybailey.net This would certainly count as "obscure", but I have a WIP project which does something similar. See http://whitequark.org/blog/2012/12/06/a-language-for-embedded-developers/ and (for a historic perspective) http://whitequark.org/blog/2011/12/21/statically-compiled-ruby/.whitequarkhttps://www.blogger.com/profile/03336457963350591446noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-83043947199666343162013-05-11T06:33:41.931-07:002013-05-11T06:33:41.931-07:00Perhaps it could be useful for a collection of obj...Perhaps it could be useful for a collection of objects in a dynamic language to be able to signal to the runtime "OK, I promise that we're done being unpredictable. You can start making assumptions about our shape now."<br /><br />Because, it seems many of the benefits of monkeying with a dynamically typed language come early in the run, at the point you set everything up; they enable nicer embedded DSLs, more expressive configuration. Then there comes a point where you could say "freeze".<br /><br />Are there examples (mainstream preferred, obscure still interesting) of this out there?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-4553762265008621122013-05-11T05:10:51.838-07:002013-05-11T05:10:51.838-07:00what are your thoughts on luajit?what are your thoughts on luajit?Anonymousnoreply@blogger.com