CommunityNews

CommunityNews

Rails 7 moves ActiveRecord::Base.logger to a class_attribute leading to a 7x speed improvement

In our opinion, this PR provides one of the simplest yet most performant speed improvements to Rails 7. Ruby recently introduced an inline cache for class variable reads. This allows for values to be read from the cache instead of traversing a complex inheritance tree to resolve a class variable value. When class variables are read, Ruby needs to check each class in the inheritance tree to ensure that the class variable isn’t set on any other classes in the tree.

As you can imagine this becomes an O(n) problem. As the number of nodes increases in a tree, the read performance degrades linearly.

Let’s look at a demonstration using a class that inherits 1 module, 30 modules and finally 100 modules…

Read in full here:

This thread was posted by one of our members via one of our news source trackers.

Where Next?

Popular Backend topics Top

New
CommunityNews
Is Zig the Long Awaited C Replacement. Comparison with previous C contenders such as C++, D, Java, C#, Go, Rust and Swift https://erik...
New
First poster: bot
It’s not legacy code — it’s PHP. Vimeo has been using PHP in production for over 15 years. Find out how we keep a million lines of PHP i...
New
paulanthonywilson
So you’re enjoying using WebSockets with Elixir’s Phoenix Framework, and you want to send some binary messages. Maybe it’s an audio clip,...
New
First poster: malloryerik
Everyone outside of tech has heard of JavaScript, Java, Python, Ruby and even .Net, but few if any have heard of F#. However, F# may be o...
New
First poster: bot
This post explains why Scala projects are difficult to maintain. Scala is a powerful programming language that can make certain small te...
New
First poster: bot
Too long have we hustled to deploy Clojure websites. Too long have we spun up one server instance per site. Too long have reminisced abou...
New
chikega
Mark Hoffman, the author of Programming WebAssembly in Rust, is a pretty hilarious lecturer if you like a dry sense of humor.
New
brainlid
In episode 81 of Thinking Elixir, we talk with Digit and Quinn Wilton about the Burrito project. It wraps up Elixir to a single binary, e...
New
brainlid
Episode 244 of Thinking Elixir. News includes the release of Elixir 1.18.2 with various enhancements and bug fixes, a new experimental SQ...
New

Other popular topics Top

AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
New
PragmaticBookshelf
Design and develop sophisticated 2D games that are as much fun to make as they are to play. From particle effects and pathfinding to soci...
New
AstonJ
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
AstonJ
I have seen the keycaps I want - they are due for a group-buy this week but won’t be delivered until October next year!!! :rofl: The Ser...
New
AstonJ
Biggest jackpot ever apparently! :upside_down_face: I don’t (usually) gamble/play the lottery, but working on a program to predict the...
New
foxtrottwist
A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
New
AstonJ
We’ve talked about his book briefly here but it is quickly becoming obsolete - so he’s decided to create a series of 7 podcasts, the firs...
New
AstonJ
Was just curious to see if any were around, found this one: I got 51/100: Not sure if it was meant to buy I am sure at times the b...
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New