News for hackers. Stuff that matters.
Re:Pitchfork: Rack HTTP server for shared-nothing architecture by tiffanyh on Wednesday October 12, 2022 @03:36PM (#33181936)
I’m still surprised that we haven’t seen much larger improvements in Ruby performance over the years given the large number of major tech companies using Ruby.

Especially from Microsoft, who has deep compiler/language expertise, and who owns GitHub (large Rails app).

Re:Pitchfork: Rack HTTP server for shared-nothing architecture by chucke on Wednesday October 12, 2022 @03:54PM (#33182158)
Not following what you mean. This server is from a shopify employer (major enough?). This server makes quite impressive improvements in terms of memory usage. Moreover, shopify is contributing a production grade JIT to the CRuby runtime.
Re:Pitchfork: Rack HTTP server for shared-nothing architecture by sosodev on Wednesday October 12, 2022 @03:57PM (#33182210)
There have been plenty of major performance improvements for Ruby but most of them require changes that just aren't feasible for a large codebase. For example, there are alternative Ruby interpreters that are far faster than the MRI but they're not usually a drop in replacement because they don't have full Gem or really general ecosystem compatibility.

Also, some performance improvements like JIT just don't matter that much for Rails because the primary problem isn't single thread performance it's the lack of cheap parallelism.

Re:Pitchfork: Rack HTTP server for shared-nothing architecture by flavorjones on Wednesday October 12, 2022 @04:40PM (#33182772)
Howdy, I'm on the Shopify team that is working on both pitchfork and a few different performance-improvement projects for Ruby. There's a ton of activity around Ruby performance right now!

I think we're entering a period of increased experimentation and rapid evolution as demonstrated by projects like YJIT[1][2], improved inline caching[3][4] and Object Shapes[5] (also used by V8), and variable-width allocation[6][7], and smaller improvements like better constant invalidation[8]. Significant investments in TruffleRuby[9] are still going on by Oracle, Shopify, and other companies.

And recently, Takashi Kokubun gave a talk at Ruby Kaigi about the future of JIT compilers in Ruby that gives a peek at a whole new set of optimizations Ruby can work on (as well as some performance comparisons against other interpreted languages)[10]. You may be surprised to see how well Ruby (with the JIT enabled) performs compared to Python 3.

All of which is to say, I think there's quite a bit of performance improvement being made in recent Rubies, and that trend will likely continue for quite some time.

[1]: https://news.ycombinator.com/item?id=28938446) [2]: https://speed.yjit.org/ [3]: https://bugs.ruby-lang.org/issues/18943 [4]: https://bugs.ruby-lang.org/issues/18875 [5]: https://bugs.ruby-lang.org/issues/18776 [6]: https://bugs.ruby-lang.org/issues/18045 [7]: https://bugs.ruby-lang.org/issues/18634 [8]: https://bugs.ruby-lang.org/issues/18589 [9]: https://eregon.me/blog/2022/01/06/benchmarking-cruby-mjit-yj... [10]: https://speakerdeck.com/k0kubun/rubykaigi-2022

Re:Pitchfork: Rack HTTP server for shared-nothing architecture by tiffanyh on Wednesday October 12, 2022 @05:07PM (#33183208)
Do you think Ruby will ever be able to catch up to PHP in raw web performance? If so, when (months/years)?

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

Please don't take my comments as unappreciation for the hard work going into Ruby.

Re:Pitchfork: Rack HTTP server for shared-nothing architecture by tenderlove on Wednesday October 12, 2022 @05:43PM (#33183883)
Which part of raw web performance? These don't seem like web performance benchmarks. IOW I'm not sure how calculating digits of PI impacts serving HTML.

Seems like we need benchmarks for actual web workloads. :)

Re:Pitchfork: Rack HTTP server for shared-nothing architecture by tiffanyh on Wednesday October 12, 2022 @06:28PM (#33184527)
PHP vs Ruby in web benchmark across multiple frameworks (and even no use of a framework) linked below.

There’s nearly an entire order of magnitude difference in performance between the best of PHP vs best of Ruby (~400k vs ~50k rps)

https://www.techempower.com/benchmarks/#section=data-r21&l=z...

Re:Pitchfork: Rack HTTP server for shared-nothing architecture by hw on Thursday October 13, 2022 @02:11AM (#33187817)
Is that an apples to apples comparison taking ngx-php vs roda on puma, esp being on ruby 2.7? Would love to see embedded ruby in nginx instead.
Re:Pitchfork: Rack HTTP server for shared-nothing architecture by jbverschoor on Thursday October 13, 2022 @06:55AM (#33189425)
Benchmark is simply incomplete and manipulative. The "best" doesn't even use an ORM, and it's mostly php anyway. Barely any ruby variants.

Also, see https://news.ycombinator.com/item?id=26071181

Re:Pitchfork: Rack HTTP server for shared-nothing architecture by bradgessler on Wednesday October 12, 2022 @06:15PM (#33184353)
Could you comment on any projects within Shopify that are helping Ruby's concurrency story? I'm aware of Ractors (https://docs.ruby-lang.org/en/master/ractor_md.html) and Fibers, but it's unclear to how feasible these primitives currently are to build the necessary abstractions on top of them that would make Rails more concurrent.

https://github.com/socketry/falcon is an interesting project, but again, it's not clear how difficult it would be deploying a Rails app on top of this. My experience with these concurrency models in Rails apps is that one single gem could make a blocking IO call (for example) and negate all of the concurrency/performance gains. It would be cool if Ruby could be configured to throw errors for these types of calls to make finding and fixing offending gems easier.

There's a lot of really great projects happening and plenty to be hopeful about, but when that stuff will land or the changes the rest of the community and ecosystem should think about making still isn't clear.

Re:Pitchfork: Rack HTTP server for shared-nothing architecture by byroot on Thursday October 13, 2022 @04:38AM (#33188659)
To be honest, Shopify isn’t particularly invested in Ruby concurrency.

That’s not really a use case we have, and the community is already investing a lot in that direction (ioquatix with fiber scheduler and ko1 with N:M threads and Ractors)

Re:Pitchfork: Rack HTTP server for shared-nothing architecture by dan_quixote on Wednesday October 12, 2022 @06:17PM (#33184372)
> I’m still surprised that we haven’t seen much larger improvements in Ruby performance over the last decade given the large number of major tech companies using Rails.

Every place I've worked in the last ~5 years has treated Ruby as "legacy" code for better or worse.

Re:Pitchfork: Rack HTTP server for shared-nothing architecture by claudiug on Thursday October 13, 2022 @05:12AM (#33188859)
I'm in the ruby world for more than 5 years. there are performance every release. For the second one, all the code is legacy after some times :)
Re:Pitchfork: Rack HTTP server for shared-nothing architecture by schappim on Wednesday October 12, 2022 @07:38PM (#33185239)
>> Yes, I'm aware of 3x3 but for the most common usage of Ruby which if for Rails apps - there hasn't been anything like the gains PHP saw from 5.x to 7.x.

This has simply not been my experience. The jump in performance in the 3.n has been awesome, to the point were I even downgraded / removed servers.

Ironically the greatest speed (and memory) improvements have been in the swapping out the supporting JS ecosystem components that Rails uses, for example swapping Webpack for the Go based Esbuild.

Re:Pitchfork: Rack HTTP server for shared-nothing architecture by ksec on Wednesday October 12, 2022 @11:21PM (#33186775)
>Especially from Microsoft, who has deep compiler/language expertise, and who owns GitHub (large Rails app).

I thought it was missed opportunities those working inside GitHub could not persuade Microsoft to at least budget out additional resources for Ruby. Although they might have their own battle trying to keep everything Rails and not moving to .NET

It does worry me a bit that all resources are coming from Shopify, hopefully they can keep growing so resources isn't a problem in the near future.

Re:Pitchfork: Rack HTTP server for shared-nothing architecture by milofeynman on Thursday October 13, 2022 @12:55AM (#33187391)
You are making multiple comments talking about Microsoft and Shopify not putting resources into Ruby/rails but both companies have core contributors on them.
Re:Pitchfork: Rack HTTP server for shared-nothing architecture by ksec on Thursday October 13, 2022 @06:26AM (#33189276)
Excuse me?

Where did I said Shopify not putting resources when the last part of my comment was exactly about Shopify putting resources into Ruby Rails.

Microsoft have contribution into Ruby? Or Do you meant Github has Core Contributor in Rails? Name me a single Microsoft employees actively helping in Ruby Core.

Re:Pitchfork: Rack HTTP server for shared-nothing architecture by byroot on Thursday October 13, 2022 @07:41AM (#33189672)
John Hawthorn from GitHub is a ruby core committer.