Screencast: Ruby's IO Buffering And You!

Published on September 25, 2012 by Jesse Storimer

Where I show you the difference between write() and syswrite(), explain what happens when you set sync = true, and dive into the Rubinius source code to bring it all together.

I've been delving into Ruby's IO system lately and finding out lots of neat things. So I decided to share a few. The whole thing is less than 10 minutes long and demonstrates a bunch of nuances about working with File and Socket in Ruby.

One quick correction. I say that the InternalBuffer class is just a regular Ruby class. The truth is that it's a Ruby class whose storage is backed by a C++ class deep inside Rubinius. So C++ is managing that memory, not Ruby.

If you enjoyed this you should get on the email list for my new book about socket programming.


Like what you read?

Join 2,000+ Ruby programmers improving their skills with exclusive content about digging deeper with sockets, processes, threads, and more - delivered to your inbox weekly.

I'll never send spam and you can unsubscribe any time.


comments powered by Disqus