@joeldrapper@ruby.social
@joeldrapper@ruby.social avatar

joeldrapper

@joeldrapper@ruby.social

Full-stack #Ruby / #Rails / #TypeScript / #CSS engineer, CEO of #HTMX, formerly at Clearscope and Shopify — author and maintainer of the gems #Phlex, Morphlex, Literal, Quickdraw — cohost the https://ruby.social/@rooftop podcast.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

andycarolan, to random
@andycarolan@social.lol avatar

So, Three UK were down in my area, across both 4G and 5G for at least 6 hours.

As I have both my Broadband and Mobile with them, I had zero connection.

I'm now organising a change of provider.

I am also tempted to try to invoice them for the time I've lost, but I imagine they have that covered in their T&C somewhere 😠

joeldrapper,
@joeldrapper@ruby.social avatar

@andycarolan Gigaclear went down for two weeks for me while I was freelancing. And I get no 4G at home. It was awful. I now have two internet connections permanently.

joeldrapper, to rails
@joeldrapper@ruby.social avatar

We just released 1.10.0! 🚀

🔎 Selective Rendering
🎒 Component Kits
🗃️ CSV Views
🚀 Up to 7× Faster
🚿 New Streaming Tools
🪶 No Runtime Dependencies

We’ll release a new version of Phlex with Phlex 1.10 compatibility soon. 🔜
https://github.com/phlex-ruby/phlex/releases/tag/1.10.0

joeldrapper, to random
@joeldrapper@ruby.social avatar

Do I know any graphic designers who could help me with branding for my open source project, “Phlex”? 🙏

joeldrapper, to random
@joeldrapper@ruby.social avatar

Some people need to hear this: Using someone’s open-source software does not entitle you to an unlimited-budget security support contract for free forever.

From the MIT License:

“THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.”

apotonick, to random
@apotonick@ruby.social avatar

My one free wish for Ruby would be to erase Nil#to_h. It's insane how far certain hash-oriented code can run with a bloody nil. Super error-prone and completely irrational to let nil be an empty hash.

joeldrapper,
@joeldrapper@ruby.social avatar

@apotonick nil probably shouldn’t have any methods apart from nil?

joeldrapper, to random
@joeldrapper@ruby.social avatar

Have you ever wondered how many equality comparisons you’d have to do in Ruby before a Hash lookup would be faster? I ran some benchmarks and the answer really surprised me. It’s just three, at least with String equality.

So this:

HASH_MAP = {  
 "a" => true,  
 "b" => true,  
 "c" => true,  
}

HASH_MAP[foo]  

Is faster than this

foo == "a" || foo == "b" || foo == "c"  

Unless one of the first two conditions match and it short-circuits.

joeldrapper, to random
@joeldrapper@ruby.social avatar

Looks like Quickdraw can currently do about 370,000 assertions per second on M3 Max (about 23k per core). So probably something like 740k assertions per second on the upcoming M3 Ultra.

joeldrapper,
@joeldrapper@ruby.social avatar

Why am I building Quickdraw? I spent over £7,000 upgrading from an 8-core M1 MacBook Pro to a 16-core M3 Max MacBook Pro. As a result, the thing I spent most my time waiting for (RSpec) got ~10% faster. Quickdraw should make it at least 16 times as fast, with equally expressive (hopefully less confusing) syntax.

joeldrapper,
@joeldrapper@ruby.social avatar

There’s only so much you can do performance-wise in a test library. At the end of the day, it’s going to be testing someone else’s code. The one thing you can do is parallelize execution between Ruby processes and Threads to take advantage of the available resources.

You can also highlight slow tests and make profiling really easy, to encourage people to optimise their suites. Quickdraw will do that too.

nyquildotorg, to random
@nyquildotorg@fedia.social avatar

I wish DHH would piss off more people so I can stop using Basecamp.

joeldrapper,
@joeldrapper@ruby.social avatar

@nyquildotorg that’s so funny. I wish DHH didn’t piss me off so I could use Basecamp. I think it’s a great product.

joeldrapper, to random
@joeldrapper@ruby.social avatar

This is the abstraction we use in Quickdraw to fan out running tests on forked Ruby processes, which can then send results back to the main process through an IO Pipe.

image/png
image/png

joeldrapper,
@joeldrapper@ruby.social avatar

When running tests, we first split the test files into a set of batches.

joeldrapper,
@joeldrapper@ruby.social avatar

Then, we loop over the batches and fork our processes before working through each queue from multiple threads.

joeldrapper,
@joeldrapper@ruby.social avatar

@pointlessone Yes. Using threads gives you concurrency — the CPU can work on thread b while thread a is sleeping or waiting on IO, etc. — but it’s still limited to a single CPU core. Forking new processes means they can run in parallel on different CPU cores.

joeldrapper,
@joeldrapper@ruby.social avatar

@pointlessone Ruby threads aren’t native threads though. At least not in MRI.

joeldrapper,
@joeldrapper@ruby.social avatar

@camertron @pointlessone I find it difficult when I’m intentionally writing code for a Ractor. I just don’t think there’s much chance of most Ruby code working.

joeldrapper,
@joeldrapper@ruby.social avatar

@pointlessone @camertron forking is quite simple because nothing is shared. With Ractors, you don’t get a mutable copy of the runtime context, you share the same copy and must not mess with it.

joeldrapper,
@joeldrapper@ruby.social avatar

@camertron @pointlessone even something like this with a frozen object raises.

benoit, to random French
@benoit@ruby.social avatar

@joeldrapper I am curious. Why this indentation on litteral gem ? Reminds me of the code from @ioquatix

joeldrapper,
@joeldrapper@ruby.social avatar

@benoit @ioquatix Because tabs are more accessible and because they have semantic meaning that can be parsed and represented in different ways depending on your preferences.

For example, if you are visually impaired, you may need to use a large font size, and you may want to configure your tabs to be 1-character wide. Or you may struggle to follow indentation and want to configure them to be 4 characters wide. It’s up to you. Also see this:

https://github.com/prettier/prettier/issues/7475#issuecomment-668544890

joeldrapper,
@joeldrapper@ruby.social avatar

@benoit @ioquatix cc @camertron out of interest, what would it take to get this added to GitHub? 🙏

:root {
tab-size: var(--tab-size-preference);
}

Somewhere in the layout:
<style>
:root {
--tab-size-preference: <%= @user.tab_size_preference %>
}
</style>

camertron, to random
@camertron@ruby.social avatar

For the last year and a half or so, I've been working on my own Ruby implementation written in TypeScript. It implements a good chunk of Ruby syntax and uses the new Prism parser. It's not even close to mature, there's no documentation, and I'm not really ready to talk about it. But that's why I'm posting this now, because it'll never be ready. I'm curious what people think and if anyone wants to collaborate. https://github.com/camertron/garnet-js

joeldrapper,
@joeldrapper@ruby.social avatar

@camertron can I run Phlex in it for demo purposes?

joeldrapper,
@joeldrapper@ruby.social avatar

@camertron this is a seriously impressive project. I’m still playing with the IRB demo.

joeldrapper, to random
@joeldrapper@ruby.social avatar

I love Ruby so much. This code makes me incredibly happy.

joeldrapper,
@joeldrapper@ruby.social avatar

Test distribution isn’t great, but we’re close to having ~16× performance running tests locally on M3 Max.

joeldrapper,
@joeldrapper@ruby.social avatar

And we now have thread-based concurrency as well as process-based parallelisation, defaulting to 2 threads per core. 🎉

joeldrapper,
@joeldrapper@ruby.social avatar

@camertron but with SQLite, you’ll be able to set up your in-memory database pre-forking and take advantage of the fact that forking the Ruby process will make that database available everywhere.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • kavyap
  • InstantRegret
  • GTA5RPClips
  • magazineikmin
  • mdbf
  • rosin
  • Youngstown
  • khanakhh
  • everett
  • slotface
  • thenastyranch
  • osvaldo12
  • DreamBathrooms
  • anitta
  • ngwrru68w68
  • ethstaker
  • modclub
  • cubers
  • cisconetworking
  • Durango
  • tacticalgear
  • tester
  • normalnudes
  • Leos
  • megavids
  • provamag3
  • lostlight
  • All magazines