News for hackers. Stuff that matters.
Re:Rails 7.1 Released by Rapzid on Friday October 06, 2023 @01:49AM (#37787491)
The performance of Rails serializers is still a nightmare. God awful performance.
Re:Rails 7.1 Released by berkes on Friday October 06, 2023 @02:40AM (#37787801)
> The performance of Rails serializers is still a nightmare

Well, The performance of Ruby is still a nightmare. Not just serializers. It's that serializers in Rails are the most prominent place where you'll have cpu-bound performance made visible.

But really. Just try anything cpu-bound (e.g. transform a huge list or CSV or so), and the lack of native, safe, threading, the horrendous performance of both the JIT compiler and the runtime and the language become apparent.

This isn't to criticize Ruby. Because once you see all the runtime inflection, the way it can modify itself runtime and the DSL magic it allows, the current performance is a magnificent feat! It should be impossible to have it perform at all, given these features. That people managed to make such a beautiful language, with such marvelous features and still have it perform like it does, is a true engineering marvel.

Re:Rails 7.1 Released by throwthrow5643 on Friday October 06, 2023 @06:06AM (#37788856)
> It's that serializers in Rails are the most prominent place where you'll have cpu-bound performance made visible.

Sorry, what other interpreted language has significantly better serializiation/deserialization performance than Ruby?

Re:Rails 7.1 Released by berkes on Sunday October 08, 2023 @04:56AM (#37808915)
Python, PHP and JavaScript have significantly better performance for cpu-bound programs.

E.g. https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

And I have measured ser/de for PHP, Ruby (and Rust, we needed to know how much faster JSON serde in rust would be, and compared it to Ruby and PHP). Php is probably much faster because the JSON ser/de is apparently written in C.

Re:Rails 7.1 Released by crystaln on Friday October 06, 2023 @02:23AM (#37787675)
20 years on…

“Just use another framework when you need performance” they say.

Re:Rails 7.1 Released by Rapzid on Friday October 06, 2023 @06:21PM (#37797099)
Also 20 years on the http client still doesn't have proper timeouts.
Re:Rails 7.1 Released by throwthrow5643 on Friday October 06, 2023 @03:59AM (#37788221)
I remember looking at BSON de/serializers for some perceived performance issue a while back, ruby was only marginally slower than PHP for the same task, which was just pulling big record sets back from the db. Can you elaborate?
Re:Rails 7.1 Released by hu3 on Friday October 06, 2023 @11:04AM (#37791745)
When was that? I ask because PHP made large improvements to performance in the last few years.

Sometimes it's more than 2x faster than before. They now have JIT and are planing to have an intermediate language for even more speed.

Most PHP stdlib code is pure C/C++ so it tends to be very fast, but I'm guessing Ruby is the same.

Re:Rails 7.1 Released by throwthrow5643 on Friday October 06, 2023 @11:10AM (#37791832)
It was about maybe late last year/Jan this year. When you say intermediate language, do you mean PHP has a bytecode interpreter instead of AST? At the time I looked at it, to convince myself there was no issue with Ruby, I actually hooked up the same table/query to PHP and used PHP's excellent profiling tools, then compared those to the Rails profiler. There wasn't a great difference. PHP was faster sure, but there was definitely no knocking Ruby's speed.