327 points · by kokonotu · 11y ago · 72 comments
You're all wonderful- merry Christmas! <3
https://twitter.com/hone02/status/548131759762968576
Although with Matz an employee I'm sure they were well ahead of the curve. ;)
For 2.1.5
AVG: 18.02
MEDIAN: 18.11
MIN: 16.26
MAX: 19.6
For 2.2
AVG: 18.162~
MEDIAN: 15.23
MIN: 14.44 <- nice
MAX: 47.03 <- first run, wut?
It looks better, but I haven't profiled the app on Passenger yet to see how well it plays with the whole app.
So I think all of their patches need to go through the bug tracker.
Hope it helps!
As of Ruby 1.9, there's a pretty sensible solution to this in the language, and I haven't had any encoding problems in some time. I appreciate I might have missed something though!
I assume that with "Ruby 1.9 solution", you refer to the fact that Ruby source code is by default evaluated as UTF-8, right?
That's definitely a good thing, but with Python3 that wasn't the only change brought into the language.
I said "if Ruby ever decides to fix", because the need for a change is not obvious and not universally accepted: it's basically the same issue as automatic type coercion (aka weak/strong typing) and early (or late) raise/throw/handling of exception.
Basically: In Python2 and Ruby you have one or two String types (runtime types, in this discussion I only care about them), with the Ruby Strings tagged with the encoding internally used. In python the types are just "anything goes" (binary strings, the old Python2 string) and unicode (the actual internal encoding is an implementation detail).
The problem (if you agree that it is one) is that you can easily mix-and-match them, and everything will work fine only as long as the operation makes sense. When it won't anymore you'll get an exception.
This is a problem when you don't completely control the type/encoding of your input (e.g. if you have an HTTP request and your string depends on the type/charset specified in the Content-Type).
A dumb example of what could happen:
a = "Ё".force_encoding "ISO-8859-5"
a2 = "®".force_encoding "ISO-8859-1"
# a + a2 will fail with Encoding::CompatibilityError
A similar thing can happen in Python2. While Python3 will reject the same operation as soon as the types get in contact with each other (still at runtime, but it'll be like doing `1+"1"` in Python or Ruby: you'll spot it right away).I wrote a quite lengthy blog post about this change in Python3, but I haven't translated it in English yet, if there's some interest I could try to do it a bit sooner.
Anyhow, I don't want to create a flame or anything like that. I just wanted to explain why the Python3 choice has been made, and why a destructive change might have had its merit. While I prefer the Python3's approach, and I'm definitely not a Ruby developer, I still appreciate these updates to Ruby: for example I actually touched first hand the internal encoding-handling code of Ruby (Rubinius) some time ago with a friend of mine: http://git.io/7kM4Gw and I can benefit from the new GC code in new rubies, which makes metasploit 4 times faster to load.
When the Ruby team makes changes the attitude is generally 'deal with it'. Sure they still do point releases on older versions but only for security issues AFAIK.
Python moves forward it just does a poor job of dragging everyone with it.
However they complement this attitude by being a lot better at working with big 3rd party library developers and making sure they are on board. To the best of knowledge there has never been a Ruby release that was incompatible with RoR for any period of time. Compare to Python that jumped to python 3 without either numpy or Django on board.
Maybe it's just the grass is always greener.
- Pythonz
- Conda
- Pew (disclaimer: I'm the author)
- Virtualenvwrapper
- Pyenv
Etc.
If you argue that people might not move to the latest and greatest as soon as possible due to the fact that people don't build their own interpreter, I can definitely agree with it: python users seem to truly prefer the python version that already comes pre-installed with their linux distribution
rvm get stable
before trying to rvm install ruby-2.2.0
You might end up getting preview1 unexpectedly.btw: anyone else thinks Rails was mentioned too much in the release note?
I think it's smart, and one of the big reasons Ruby seems to manage version-to-version transition so well. Just look at python 3 to see what happens when a language moves forwards without taking its biggest 3rd party libraries into account.
Vfork in most older systems is like fork except it doesn't deeply duplicate all process state immediately (file handles, memory, such), so it can be faster if all the app wants to do is fork/exec. (We had to implement both fork and vfork in minix 2.x in uni.^)
But according to SO, most OSes implement fork lazily, so there's not much point in using it when fork will be just as fast without any change.
If there were a slowly-performing platform that has a specific performance issue identified by profiling as caused by fork, then mature optimization could follow. Otherwise, it seems like adding LoC without a clear goal.
The Symbol GC sounds good. Maybe this will imply code can associated with classes and modules can be GCed and required anew once all objects are freed (live upgrade apps without restarts).
^ The first thing I did to the Minix codebase was set keyboard repeat rate to the fastest possible values. Everyone else seemed content to waste their life waiting for their editor and debugger to move at a snail's pace. Of course, no else had x86 asm / pc hw io experience.
For example, 'FooBarWidget @ Passenger 5 "Raptor" is a well-crafted, thoughtful achievement in terms of app servers.
2.2 Symbol GC also sounds great. I'm just not convinced there is enough innovation to make Ruby an order-of-magnitude faster, use less memory / return memory back to the system.
A less easily fixed change is that the following syntax no longer works the same as it did in previous versions of Ruby:
def foo(bar = bar)
The recommended fix is the following: (I believe) def foo(bar = bar())
Rails uses this syntax occasionally. It's simple to change, but the Rails team refuses to merge in the fixes because it's not a security issue.Do you know if the Rails team would approve a patch that was submitted?
Also, the change of the meaning of the right bar in your example above seems significant. Do you happen to know of any context for that change?
This allows you to symbolize external hash keys without fear of a DOS attack.
As for performance, I think we'll have to wait to hear from adventurous souls who use this, or who have been using the rc's.
Hopefully you've been using New Relic and can see how memory usage on your dynos changes.