Twitter | Search | |
Sean Griffin
So I still have a *ton* of work to do, and this code is not particularly well optimized (or complete), but my naive PoC for this is showing nearly a 2x speedup for Active Record. (measuring `Post.all.each(&:attributes)` on 1k records)
Reply Retweet Like More
Sean Griffin Nov 8
Replying to @sgrif
I was expecting something like 5-10%, this is insane
Reply Retweet Like
Benoit Tigeot Nov 8
Replying to @sgrif
Context for people how are lost like me :
Reply Retweet Like
Michael Gattozzi | マイケル・ガトジイ Nov 8
Replying to @sgrif
A naive implementation with a 200% speed up? Imagine if you actually optimized it.
Reply Retweet Like
David T. Harris Nov 8
Replying to @Benoit_Tgt @sgrif
Ahh - always good to have context - thank you!
Reply Retweet Like
Willem van Bergen Nov 8
Replying to @sgrif
Awesome work!
Reply Retweet Like
Sean Griffin Nov 8
Replying to @wvanbergen
Thanks. I'm just glad I've been able to have time to work on this. <3
Reply Retweet Like
Sean Griffin Nov 8
Replying to @mgattozzi
I think the answer is actually 2x. I spent a bit of time optimizing this morning before I scrapped the prototype. Instruments shows all the overhead on the Ruby side
Reply Retweet Like
Sean Griffin Nov 8
Replying to @mgattozzi
The only easy win I see left is if Ruby had an equivalent of `HashMap::with_capacity` (or `rb_ary_new_capa` on their end), as ~3% of time is spend re-allocating a hashmap with a known size
Reply Retweet Like
Sean Griffin Nov 8
Replying to @mgattozzi
Though this is also in the benchmark for `ActiveRecord::Base#attributes` which literally nobody calls, but is a good proxy for "I read all of the fields on this thing"
Reply Retweet Like
Nate Berkopec Nov 9
Replying to @sgrif
booiiiiii
Reply Retweet Like
Godfrey Chan Nov 9
Replying to @sgrif @mgattozzi
+1
Reply Retweet Like
Mike Pastore ❄️ Nov 9
Replying to @sgrif @mgattozzi
It will juice the AR benchmarks in TFB!
Reply Retweet Like
Mark Villacampa Nov 9
Replying to @sgrif @nateberkopec
niiiice!! will this mean we’ll have to have rust installed to install AR?
Reply Retweet Like
Sean Griffin Nov 9
No
Reply Retweet Like
Iain McNulty Nov 9
Replying to @sgrif @mgattozzi
Why do you say literally no one calls attributes?
Reply Retweet Like