Latest Posts (15 found)
Tenderlove Making 2 months ago

Apple Photos App Corrupts Images

The Apple Photos app sometimes corrupts images when importing from my camera. I just wanted to make a blog post about it in case anyone else runs into the problem. I’ve seen other references to this online, but most of the people gave up trying to fix it, and none of them went as far as I did to debug the issue. I’ll try to describe the problem, and the things I’ve tried to do to fix it

1 views
Tenderlove Making 2 months ago

File preallocation on macOS in Ruby

I haven’t blogged in a while, so I figured I should do that. Jet lag has blessed me with some free time this morning, so I figured I would make some content in order to feed the AI bots. I’ve been messing around with pre-allocating files on the file system on macOS. This is useful in cases where you have a large file you need to copy, and you want to copy it quickly

0 views

Monkey Patch Detection in Ruby

My last post detailed one way that CRuby will eliminate some intermediate array allocations when using methods like and . Part of the technique hinges on detecting when someone monkey patches array. Today, I thought we’d dive a little bit in to how CRuby detects and de-optimizes itself when these “important” methods get monkey patched

0 views

Eliminating Intermediate Array Allocations

Recently I gave a talk at RailsWorld (hopefully they’ll post the video soon), and part of my presentation was about eliminating allocations in tokenizers. I presented a simple function for measuring allocations: Everything in Ruby is an object, but not all objects actually make allocations. We can use the above function to measure allocations made in a block

0 views

Using Serial Ports with Ruby

Lets mess around with serial ports today. I love doing hardware hacking, and dealing with serial ports is a common thing you have to do when working with embedded systems. Of course I want to do everything with Ruby, and I had found Ruby serial port libraries to be either lacking, or too complex, so I decided to write my own

0 views

Fast Tokenizers with StringScanner

Lately I’ve been messing around with writing a GraphQL parser called TinyGQL . I wanted to see how fast I could make a GraphQL parser without writing any C extensions. I think I did pretty well , but I’ve learned some tricks for speeding up parsers and I want to share them. Today we’re going to specifically look at the lexing part of parsing

0 views

Bitmap Matrix and Undirected Graphs in Ruby

I’ve been working my way through Engineering a Compiler . I really enjoy the book, but one part has you build an interference graph for doing register allocation via graph coloring. An interference graph is an undirected graph , and one way you can represent an undirected graph is with a bitmap matrix. A bitmap matrix is just a matrix but the values in the matrix can only be 1 or 0

0 views

Vim, tmux, and Fish

I do most of my text editing with MacVim , but when I pair with people I like to use tmate . tmate is just an easy way to connect tmux sessions with a remote person. But this means that I go from coding in a GUI to coding in a terminal. Normally this wouldn’t be a problem, but I had made a Fish alias that would open the MacVim GUI every time I typed in the terminal

0 views

In Memory of a Giant

The Ruby community has lost a giant. As a programmer, I always feel as if I’m standing on the shoulders of giants. Chris Seaton was one of those giants. I’ve been working at the same company as Chris for the past 2 years. However, I first met him through the open source world many years ago. He was working on a Ruby implementation called TruffleRuby , and got his PhD in Ruby

1 views

Cross Platform Machine Code

I hate writing statements. I’ve been working on a couple different assemblers for Ruby. Fisk is a pure Ruby x86 assembler. You can use it to generate bytes that can be executed on x86 machines. AArch64 is a pure Ruby ARM64 assembler. You can use it to generate bytes that can be executed on ARM64 machines

0 views

Homebrew, Rosetta, and Ruby

Hi everyone. I finally upgraded to an M1. It’s really really great, but the main problem is that some projects I work on like TenderJIT and YJIT only really work on x86_64 and these new M1 machines use ARM chips. Fortunately we can run x86_64 software via Rosetta , so we can still do development work on x86 specific software

0 views

Publishing Gems With Your YubiKey

The recent compromise of has put the security and trust of published packages at the top of my mind lately. In order to mitigate the risk of any Ruby Gems I manage from being hijacked, I enabled 2FA on my RubyGems. org account. This means that whenever I publish a Ruby Gem, I have to enter a one time passcode. I have to admit, I find this to be a pain

1 views

Debugging an Assertion Error in Ruby

I hope nobody runs in to a problem where they need the information in this post, but in case you do, I hope this post is helpful. (I’m talking to you, future Aaron. lol) I committed a patch to Ruby that caused the tests to start failing. This was the patch: This patch is supposed to allow objects passed in to to move

0 views

Counting Write Barrier Unprotected Objects

This is just a quick post mostly as a note to myself (because I forget the commands). Ruby objects that are not protected with a write barrier must be examined on every minor GC. That means that any objects in your system that live for a long time and don’t have write barrier protection will cause unnecessary overhead on every minor collection

0 views

Guide to String Encoding in Ruby

Encoding issues don’t seem to happen frequently, but that is a blessing and a curse. It’s great not to fix them very frequently, but when you do need to fix them, lack of experience can leave you feeling lost. This post is meant to be a sort of guide about what to do when you encounter different types of encoding errors in Ruby

1 views