I still want to write compilers. My career strategy to turn Ruby JIT development from a hobby to a job after moving to the U.S. C-house

My name is@Go_daichiCS. I am a committer of the programming language Ruby, working in Silicon Valley since 2019 and developing a Ruby Just-In-Time ("JIT") compiler full time at a company called Shopify since 2022.

My current position was the first time I turned my long-time hobby of compiler development into a job. This article describes how I turned my hobby into a job and how I changed careers into a field in which I had no business experience.

 

A career writing distributed systems at work and compilers as a hobby
I have been interested in writing compilers since I was a student, but I have been developing web applications and distributed systems at work for a long time. Let me start by telling you how I got into a non-compiler job.

Ruby Engineer, which I arrived at in search of a job where I could have fun and make money.
I like making games, and until I became a college student, I was involved in an activity called Super Masao, which involved making games using Java applets, RPG Tskool, etc. In my second or third year of college, I worked part-time developing iOS game applications. It seems that I have always chosen to do what I "enjoy" the most as my job.

When I was developing the server side of the iOS application, the president of my part-time job recommended the CakePHP framework, and when I picked up a reference book, it said something like, "CakePHP was created under the influence of Ruby on Rails. I picked up a reference book and found that "CakePHP was influenced by Ruby on Rails" at the beginning of the book. At the time, people I followed on Twitter were also using Ruby, so I became interested in Ruby, and with the president's permission, I started writing the server side in Ruby.

At the time, there was no Swift, and iOS apps had to be written in Objective-C, which I found to be a very difficult language to write. When I started writing Ruby, I found that it was so much easier to write in Ruby that I began to enjoy writing server-side applications in Ruby more than creating front-end applications for games. I naturally wanted to do that kind of work.

At that time, Cookpad was known as a company that used Ruby, and I saw an interview with a famous engineer and Ruby committer, and I wanted to write Ruby and work with those amazing engineers. I received a job offer as an intern during the summer of my junior year of college, and since I had almost completed my college credits, I continued working at COOKPAD almost full-time as a part-timer, and then went straight into the workforce as a Ruby engineer.

Research interests in both distributed systems and language processing systems
When I started my part-time job at Cookpad, two other senior students who were three years above me at the same university were also interning at Cookpad. During that short time, one (@draftcode) was working on RRRSpec, a distributed test execution system, and the other (@eagletmt) was working on a parallel installation function for Bundler, I was recommended by both of them, and since my research field of language processing and parallel systems also seemed interesting, I joined the same lab in my senior year of college.

In this laboratory, we learned Scheme, a dialect of LISP, in class and were given the task of creating our own interpreter for it, which I implemented in the Go language. There was a compiler class at Tokyo Institute of Technology where I was, but it was one in which we did not write any code at all or only slightly modified what the teacher had written, so I think this was the first time I learned how a language processing system works while investigating the whole system and building it myself.

Also, draftcode's master's thesis was a research on writing a compiler in Go, and since I used Go for my assignment, I decided to take over the project as my bachelor's thesis research. RRRSpec, which draftcode-san was working on, is also a relatively complex distributed system, and my interest in distributed systems sprouted partly because of my research field.

On the other hand, Cookpad was using Haml as a template language for Ruby on Rails, but Slim was faster. eagletmt's implementation of Haml, called Faml, was much faster, close to Slim, and was introduced into Cookpad's production. It was also introduced into Cookpad's production.

However, I preferred Haml as a language and was interested in writing my own, so I scratched another Haml implementation, Hamlit, and finished it just before graduation. This became the first Haml implementation that was faster than Slim, and it won first place in the Ruby GitHub Trending. This successful experience shaped my strong interest in optimizing language processing systems.

At that time, Hamlit had an implementation omission, but we fixed it the following month, and seven years later, it became an official implementation of Haml.


High Performance Template Engine - Speaker Deck (RubyKaigi 2015)

Distributed middleware at work, JIT compiler as a hobby OSS activity
At COOKPAD, I was developing new services in Rails when I was working part-time, but since I was more interested in the technology itself than the services, I wanted to join the development infrastructure group where many star engineers including Tatsuhiko Miyagawa (@miyagawa) were working, and started working there as a full-time employee in 2015. I started working there as a full-time employee.

At the time, none of the Ruby committers at Cookpad were working on Ruby development itself, and it seemed difficult to get paid for language processing development in Japan.1 On the other hand, my other interest, distributed systems and middleware development, seemed like something I could somehow make work, I also developed the job queue infrastructure when it was needed in the company.

This system was written in Ruby, but in the industry in general, Ruby work was mostly web application development using Rails, and distributed systems used Java and other languages with threads running in parallel. Therefore, I began to feel frustrated that I could not gain experience in languages used for distributed systems at Cookpad, where everything is written in Ruby, so I moved to Treasure Data, which does both Ruby development and Java distributed systems.

At Treasure Data, I gained experience developing large-scale distributed systems using non-Ruby languages such as Java, Kotlin, and Scala. Since I was interested in optimization in general and distributed systems in particular, it was a pleasure to join the storage team and work on distributed database optimization.

There were many Ruby committers and Rails committers at Treasure Data at the time, but no one was making it their job. I also became a Ruby committer and spent my days practicing OSS activities such as optimizing the template engine ERB, C compiler using LLVM, Ruby JIT compiler, and self-hosted JVM as a hobby.

As you can see, you need to belong to a company to develop a large-scale distributed system like this, but you can develop language processing systems as a hobby. Therefore, at this point, I thought that a career in distributed systems as a job and language processing systems as a hobby would be the most enjoyable career for me and allow me to pursue both interests.

I knew that was the combined impetus for making compilers my career.
Although I am still interested in both technologies, distributed systems and compilers, I am now concentrating solely on language processing systems development, both for work and as a hobby. In this chapter I will discuss the reasons for this.

While working and attending graduate school, I realized that I like compilers best.
During my undergraduate years at university, while all my friends were going on to graduate school, I chose to work for financial reasons. On the other hand, when I looked at the active engineers around me, not a few of them had master's or doctoral degrees. They told me that they had studied fields such as distributed systems in graduate school, and I knew that I wanted to go to graduate school someday and relearn the fields I was interested in.

One day in 2016, I became interested in graduate school for working professionals after reading about Rui Ueyama (@rui314) who started attending Stanford while working. In 2018, after changing jobs, I was able to get the majority of my tuition paid for by my company benefits, and I took classes at Stanford myself and realized that I could get good grades even while working.

However, I gave up the idea of attending Stanford, considering that my undergraduate grades were not very good and did not surpass the threshold for footing the bill, and that the tuition was too expensive. On the other hand, I learned that several people I knew were attending a similar program at Georgia Tech, and since I thought I would be able to surpass the selection criteria here and the tuition was at the lowest level, I enrolled in the fall of 2020 after immigrating to the United States and graduated in the spring of 2022.

Of the four most difficult classes at this university, one was distributed systems and one was compilers. I took both and found them to be objectively equally difficult and interesting classes. While I was able to achieve higher grades in both classes, if anything I was more passionate about the compiler. I had previously thought that I was equally interested in both distributed systems and compilers, but this was the moment I realized that I was actually more interested in compilers.


The frustration of being separated from competitors who work with compilers
After the birth of my child in the summer of 2020, I either spent every waking moment with my child or worked at the company. Since my non-work activities would take place while my child was sleeping, I had less time to spend on developing JIT compilers than before. While the development speed of MJIT, which I developed as a hobby, has slowed down, rival implementations such as Shopify's YJIT and MIR by Vladimir Makarov (vnmakarov) of RedHat are being developed successfully as work. The gap in workmanship between my implementation and rival implementations was widening.

I found myself spending more time on distributed systems, even though I realized that I was more interested in compilers than distributed systems as a result of my graduate coursework. To make up for this, I tried to work harder at my hobbies, but I had to cut back on sleep and other activities, and as I got older, I realized that this would be a limitation.

I realized that if I did what I was most interested in, I would not have to push myself so hard, and I could achieve what I wanted to do most simply by working within my business hours. At the beginning of 2022, some time after I began to think this way, Maxime Chevalier-Boisvert (@Love2Code), a lead engineer on Shopify's YJIT team, which was a rival implementation, invited me to join his current position. However, I had a hard time making up my mind for six months before actually changing jobs.

A Turning Point in the Market and a Green Card
The reason why I didn't change my job easily at that time was because of the start-up treatment and the U.S. visa.

I joined Treasure Data right after the Series C funding and became a bit cash rich due to the company's acquisition by Arm in 2018. After getting a taste, I was waiting for such an opportunity again and was reluctant to change jobs because I knew it would be difficult to move to another company and earn a comparable income.

However, the economy, which had been doing extremely well in 2021, entered a recession in 2022, and I had no idea when I would be able to wait a little longer and change jobs when the break came. In the meantime, I obtained a green card, which is permanent resident status in the U.S., in the spring of 2022.

A green card is a process that usually takes two to three years, and if you change jobs in the middle of that time, you have to start over from scratch. Furthermore, during Corona, due to the Trump administration's restrictions on re-entry for visa workers, I had almost no intention of changing jobs, at least not until I got my green card. In fact, when we see visa workers in trouble in the second half of 2022 with various companies laying off workers due to the recession, before they get their green cards.

 

キャリアの選択で大切にしていること

最後に、自分がどこでどのくらい働くかを決めるとき、何を基準に考えているかをお話しします。

私は転職するたびに、自分が持っていない何らかの技術を周りの人が持っている環境に身を置くようにしています。そもそも私は技術を使って何を作るかより、技術そのものの完成度や理解度を高めることの方に関心があるのですが、効率的に技術力を上げていく上でどの環境を選ぶかはとても大きなインパクトがあることを経験上知っているからです。技術力向上に限らず、自分がなりたい像に近い人たちと時間を過ごすことは、目標への道筋の解像度を上げるために役立ちます。

また、自分の技術的興味の追求は自分の人生の一要素でしかなく、自分が仕事をすることで家族や自分が幸せに暮らせるかどうかを大切にしています。私の稼ぎで妻と子を養う都合、お金はとても大切で、単に自分がやりたい仕事をやるだけではなく、それによって会社やビジネスにもたらすインパクトが最大になるように努力し、それによって相応のお金ももらえる環境に身を置くことで、関わる全員が幸せになるような状態を目指しています。

東京よりも給与水準が高い海外の地域で暮らすと、同じ労力で倍以上の収入が得られる機会が珍しくないので、試したことがない方は一度挑戦してみてもよいかもしれません。

制作:C-house