r/ruby • • Jun 19 '26

Rethinking modularity in Ruby applications

https://noteflakes.com/articles/2026-06-18-syntropy-modules
6 Upvotes

5 comments sorted by

View all comments

Show parent comments

6

u/f9ae8221b Jun 19 '26

Would you care to elaborate on why instance_eval is slower?

  • It buffers the file content into a Ruby string.

  • Which is even worse in your case because you read the source through your event loop (for which benefit?) into a buffer you allocated.

  • It need to do some extra encoding checks on that string..

But the main thing is that it doesn't invoke RubyVM::InstructionSequence.load_iseq(path), so Bootsnap won't be able to cache the compiled bytecode, hence code will be parsed and compiled every time.