Complexity of lib/roda.rb has increased significantly since 3.0

93 views
Skip to first unread message

Janko Marohnić

unread,
Oct 28, 2019, 10:01:44 AM10/28/19
to Roda
I've been following the performance improvements made for Roda, and have watched the related talk given at RubyKaigi this year. While I understand the goal, I've also noticed a significant impact on the readability of lib/roda.rb. And that's coming from a long-time Roda user who already has good familiarity with Roda's codebase.

The LOC of lib/roda.rb has increased by almost 50% since 3.0, and that makes me a bit concerned. I would like Roda to remain simple to understand, and for me it was already fast enough (in my experience the majority of the response time always came from the actual application code). I would like to understand more what are the performance benefits gained, because at the moment I don't see how they're worth the added complexity.

I hope this doesn't come off as overly negative. I still have deep appreciation for Jeremy and all he's doing for Roda and the Ruby ecosystem. I just wanted to voice my opinion on some of the decisions.

Kind regards,
Janko

Jeremy Evans

unread,
Oct 28, 2019, 12:45:14 PM10/28/19
to Roda
You are correct that Roda has gotten significantly more complex this year.  There were very few changes to lib/roda.rb from 3.0.0 to 3.16.0, but between 3.16.0 and 3.19.0, there were a lot of changes and added complexity to improve performance.

In most Ruby web applications, time spent in the application code is greater than time spent in framework code, even for frameworks that are not as efficient as Roda.    If you look at the CHANGELOG, you'll see multiple cases where Roda performance improved 2-4x (more detail is ).  Now, if you have a route that spends 10% of the time in Roda and 90% of the time in your application code, a 2x performance improvement in Roda only improves your application performance by about 5%.  I think in many applications, a total application speedup of 5% would be considered significant, and especially appreciated if no application code changes are required other than bumping a dependency version.

I believe the added complexity is worth the extra performance it brings.  In my own applications, I've seen improvements up to 3x in some commonly requested routes due to the performance improvements made this year.  Those are more extreme cases, but there are definitely cases where Roda's performance improvements have led to a 2-3x performance improvement in real world applications.

The faster your application already is, the more benefit you will see from Roda's improved performance, because a faster application will spent a greater percentage of time in Roda than a slower application.

Two of Roda's goals are simplicity and performance.  Unfortunately, there are times where improving performance makes things less simple internally, and tradeoffs have to be made. Ultimately, there are many more Roda users than there are Roda developers and contributors, and I think the majority of users would appreciate improved performance even if it decreases internal simplicity.

Thanks,
Jeremy

Janko Marohnić

unread,
Oct 28, 2019, 1:12:11 PM10/28/19
to Roda
Wow, thank you for the detailed answer, these results sound impressive. This is what I needed to hear, I will try to spend more time learning about how the new optimizations work.

It's true that the complexity of how Roda actually works hasn't changed much, I only noticed the optimizations around allocations and method calling, which one can glance over as an implementation detail.

Thank you again for your amazing open source work, I'll always be happy to contribute in any way I can :)

Kind regards,
Janko
--
You received this message because you are subscribed to a topic in the Google Groups "Roda" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ruby-roda/71BRGsBToeY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ruby-roda+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-roda/e56aa7df-ec92-4eaa-aff2-20113ac8f916%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages