tag:blogger.com,1999:blog-4704664917418794835.post6804148115098747648..comments2023-07-01T05:41:30.469-07:00Comments on Headius: So You Want To Optimize Rubyheadiushttp://www.blogger.com/profile/15717357218364947795noreply@blogger.comBlogger17125tag:blogger.com,1999:blog-4704664917418794835.post-68626263168478878082013-01-05T17:47:10.387-08:002013-01-05T17:47:10.387-08:00Would it be possible & realistic/practical to ...Would it be possible & realistic/practical to introduce runtime options to disable some languages features thus enabling better optimization?? I personally could very well live without frame-local values, block as a binding and Fixnum to Bignum promotion if it provided substantial performance improvement.Colin Surprenanthttp://colinsurprenant.com/noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-86041250078798660372012-11-09T14:16:09.045-08:002012-11-09T14:16:09.045-08:00Hello Charles,
Unrelated to this post but I h...Hello Charles,<br /><br /> Unrelated to this post but I have thoroughly enjoyed javaone JIT for dummies.<br /><br />Keep up the good work,<br />Khalil<br />Khalilhttps://www.blogger.com/profile/08118327649880443283noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-14872263873789037192012-11-04T01:27:18.845-07:002012-11-04T01:27:18.845-07:00What was so bad about Java and .NET that they came...What was so bad about Java and .NET that they came with Ruby?....Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-22977923677632953662012-11-01T12:14:48.230-07:002012-11-01T12:14:48.230-07:00Out of interest, would rails go close to running i...Out of interest, would rails go close to running if you dropped support for your top removal features? I could see some interest in a ruby subset that could be highly optimised - jruby -fast! It would be good to at least have a mode which discourages the use of hard to optimise features.Jeff Williamshttps://www.blogger.com/profile/12799685631896443869noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-34093816769487167212012-10-19T01:03:38.001-07:002012-10-19T01:03:38.001-07:00The small performance gain is it not worth to give...The small performance gain is it not worth to give up fixnum to bignum promotion. This is a basic features of scripting languages and I think ruby should stay a scripting language ;) Especially in JRuby it's easy to improve the performance of static code: write it in Java (or another JVM static language). Javascript has the ability for fixnum to bignum conversion, too. Nevertheless, this language is very fast. <br />The frame local variables are ugly. I would not miss them. But I think it is not a good idea to remove such heavily used features in ruby. <br /><br />In the most cases the performance of ruby is very good. Instead of change the whole ruby language, one could define a subset of ruby and activate it for special methods which need good performance. For example:<br />fast_ruby do<br /> # here comes fast code without eval, framelocal variables, fixnum to integer promotion etc.<br />endAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-60645009913560102282012-10-18T16:42:39.740-07:002012-10-18T16:42:39.740-07:00About the «C extension support» section, I think t...About the «C extension support» section, I think that if you need the speed of a C snippet, the best option is to make an standard shared library, and load the functions in it with FFI. As far as I know, most implementations support FFI without problemsAyosehttps://twitter.com/ayosecnoreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-78339534700425754622012-10-18T09:26:03.735-07:002012-10-18T09:26:03.735-07:00Sorry, ninkibah == Jonathan O'ConnorSorry, ninkibah == Jonathan O'Connorninkibahhttps://www.blogger.com/profile/14380439556304893396noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-43989934617656684982012-10-18T09:24:55.655-07:002012-10-18T09:24:55.655-07:00@Benoit: 99% of the time I know if my code might o...@Benoit: 99% of the time I know if my code might overflow, and in that case, I'd take the perfomance hit and use Bignums from the start. Yes, some benchmarks and tests might break, and maybe a small amount of existing ruby code, but nothing major.<br /><br />@Mark: Expandonum, great name. Of course, it will still take a performance hit over straight integers.<br /><br />@Charles: I suppose you could add a flag to JRuby to not do integer promotions.<br />As to the other changes, you could ask Matz to deprecate them in Ruby 2.x, and then to remove them in 3.0 :-)<br /><br />Sheesh, these captchas are getting hard, and I pity the poor visually impaired who try the audio captcha. That's even worse!ninkibahhttps://www.blogger.com/profile/14380439556304893396noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-5099115605697480492012-10-18T07:16:44.980-07:002012-10-18T07:16:44.980-07:00Agh... didn't mean to post that last one about...Agh... didn't mean to post that last one about Expandonum anonymously.Mark Menardnoreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-79514543310630274592012-10-18T07:10:43.061-07:002012-10-18T07:10:43.061-07:00Charles could you get rid of Fixnum to Bignum prom...Charles could you get rid of Fixnum to Bignum promotion, could you introduce another type such as Expandonum that would do the promotion when someone wants it?Unknownhttps://www.blogger.com/profile/11608094751943802338noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-62865942798480925032012-10-16T16:56:05.616-07:002012-10-16T16:56:05.616-07:00Fantastic post. Thanks for being so comprehensive...Fantastic post. Thanks for being so comprehensive!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-72857589065188777952012-10-16T15:54:28.749-07:002012-10-16T15:54:28.749-07:00@Charles: I'd mostly agree on frame-local valu...@Charles: I'd mostly agree on frame-local values and block bindings, but I think removing automatic Fixnum to Bignum promotion would hurt a lot (I'm thinking integer overflow is not funny in a high-level language. Even if it's crazy to think any number can be represented, I find it useful in many cases).Benoit Dalozenoreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-21786544331791937602012-10-16T10:11:11.959-07:002012-10-16T10:11:11.959-07:00Jonathan: My top features to remove from Ruby woul...Jonathan: My top features to remove from Ruby would be the behavior of frame-local values ($~, $_, method visibility, etc), the ability to use a block as a binding (prevents a number of optimizations) and Fixnum to Bignum promotion (slows math, prevents aggressively optimizing to primitive integer). Most other features -- including dynamic/duck typing, metaprogramming, and closures -- can be optimized very well if not for some of these others.headiushttps://www.blogger.com/profile/15717357218364947795noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-60728747556970302512012-10-16T05:32:53.979-07:002012-10-16T05:32:53.979-07:00> Secondly, are there any languages, offering d...> Secondly, are there any languages, offering duck-typing, closures and metaprogramming features, that can be heavily optimized?<br /><br />Metaprogramming should always be free at run-time, but duck-typing and closures are necessarily expensive (and pure evil imo!)Anonymoushttps://www.blogger.com/profile/17575049133687228779noreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-70108419747657848752012-10-16T02:08:45.279-07:002012-10-16T02:08:45.279-07:00It doesn't even have to be Shen or Haskell-sty...It doesn't even have to be Shen or Haskell-style static typing.<br />Dirkhttp://www.tvspiegel.comnoreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-69020874783911745832012-10-16T01:47:27.033-07:002012-10-16T01:47:27.033-07:00Javascript?Javascript?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4704664917418794835.post-14265169540365916172012-10-16T00:28:36.072-07:002012-10-16T00:28:36.072-07:00Given these optimization problems, if you could ch...Given these optimization problems, if you could change 3 language features, and yet retain the ruby flavor, what would they be?<br /><br />Secondly, are there any languages, offering duck-typing, closures and metaprogramming features, that can be heavily optimized? (Please don't say LISP, even though I spent 2 years in college in love with it!)Jonathan O'Connornoreply@blogger.com