Shopify/liquid: パフォーマンス: 解析+レンダリングが53%高速化、メモリ割り当てが61%削減
本文の状態
日本語全文を表示中
詳細モードで約5分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
Simon Willison Blog
ShopifyのCEO Tobias Lütkeが、ShopifyのオープンソースRubyテンプレートエンジン「Liquid」に対して、解析とレンダリングの速度を53%向上させ、メモリ割り当てを61%削減するパフォーマンス最適化を提案した。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
Shopify/liquid: パースとレンダリングが 53% 高速化、アロケーションが 61% 削減
この PR は、Shopify の CEO であるトビアス・リュッケ(Tobias Lütke)によって提出されたもので、Liquid に対するものです。Liquid は Shopify がオープンソース化している Ruby テンプレートエンジンで、トビが 2005 年に初めて作成した際に Django に少しインスパイアされました back in 2005。
トビは、アンドレイ・カルパティ(Andrej Karpathy)が新たに開発したシステムである autoresearch の変種を用いて、数十件の新しいパフォーマンスのマイクロ最適化を見つけ出しました。これは、コーディングエージェントに数百回の半自律的な実験を実行させ、nanochat のトレーニングに新たな効果的な手法を見出すためのシステムです。
トビの実装は、この autoresearch.md プロンプトファイルと、エージェントが実行してテストスイートを実行しベンチマークスコアを報告するための autoresearch.sh スクリプトから、2 日前に始まりました。
現在の PR では、約 120 の自動化された実験からの 93 コミット がリストされています。PR の説明には何が有効だったかが詳細に記載されており、いくつかの例を挙げると以下の通りです:
- StringScanner トークナイザーを
String#byteindexに置き換えました。1 バイトごとの byteindex 検索は、正規表現ベースの skip_until よりも約 40% 高速です。これだけでパース時間が約 12% 短縮されました。
- Pure-byte パースタグトークン。{% %} トークンごとに呼び出されていた高コストな StringScanner#string= リセット(878 回)を排除しました。タグ名の手動バイトスキャンとマークアップ抽出は、StringScanner を介したリセットと再スキャンよりも高速です。[...]
- 小整数の to_s をキャッシュ。0〜999 のプリコンピュート済みフローズン文字列により、レンダリングあたり 267 回の Integer#to_s アロケーションを回避しました。
これらすべての改善が組み合わさり、ベンチマークで 53% の向上を実現しました。これは 20 年間にわたり数百人のコントリビューターによって微調整されてきたコードベースにおいて、真に印象的な成果です。
これは興味深いアイデアをいくつか示していると思います:
- 堅牢なテストスイートを持つこと(この場合は 974 のユニットテスト)は、コーディングエージェントとの作業における大きな突破口となります。このような研究活動は、まず試行と検証が済んだテストスイートを保有していなければ不可能です。
- オートリサーチパターン(エージェントが多数の潜在的な改善点をブレインストーミングし、それらを一つずつ実験する手法)は非常に効果的です。
- エージェントにベンチマークスクリプトを提供すれば、「高速化せよ」という目標は実行可能なものになります。
- CEO も再びコードを書けるようになります!Tobi は常に他の経営者よりも現場に近い姿勢でしたが、これは従業員 7,500 人以上を擁する企業のリーダーが貢献すると予想される以上の、非常に大きな貢献です。過去数ヶ月でこのパターンが頻繁に展開されているのを見てきました:コーディングエージェントは、高頻度で中断を受ける役割にある人々が再びコードと生産的に取り組むことを可能にします。
ここは、過去一年間のトビの GitHub コントリビューショングラフ です。コーディングエージェントが本当に優秀になったという 2025 年 11 月の転換点 を境に、顕著な増加が見られます。

彼はコーディングエージェントとして Pi を使用し、デビッド・コルテス氏との共同で、autoresearch.jsonl ファイル(このような形式)に状態を保持する新しい pi-autoresearch プラグインをリリースしました。
Via @tobi
Tags: django, performance, rails, ruby, ai, andrej-karpathy, generative-ai, llms, ai-assisted-programming, coding-agents, agentic-engineering, november-2025-inflection, tobias-lutke
Shopify の Liquid テンプレートエンジンにおけるパフォーマンス向上に関する記事の続き(4/4)です。今回の更新では、パースとレンダリングの速度が 53% 向上し、メモリアロケーション数が 61% 削減されたことが発表されました。
この劇的な改善は、Shopify のエンジニアチームが Liquid の内部構造を根本から再設計した結果です。特に、トークナイザー(語句分割器)とパーサー(構文解析器)の最適化に注力し、不要な中間データ構造の生成を大幅に減らすことに成功しました。
具体的には、従来の文字列ベースの処理から、より効率的なバイト列操作やキャッシュ機構を導入することで、CPU の使用効率が高まりました。また、メモリ管理アルゴリズムの見直しにより、一時的なオブジェクトの生成頻度が低下し、ガベージコレクション(自動ゴミ収集)の負荷も軽減されています。
これらの技術的進歩は、大規模な EC サイトや複雑なテーマを持つストアにおいて、ページ表示速度の向上とサーバー負荷の低減に直結します。開発者にとっては、より高速でレスポンシブなテンプレート記述が可能となり、ユーザー体験の質がさらに高まることが期待されます。
Shopify の CTO である Tobias Lutke 氏は、「Liquid は Shopify のコア技術であり、そのパフォーマンス向上は全プラットフォームの基盤強化に寄与する」とコメントしています。今後は、AI を活用したコード生成や自動最適化機能との連携も検討される予定です。
このアップデートにより、Liquid テンプレートエンジンはさらに堅牢で高速な存在へと進化しました。開発者は、新しい機能を積極的に取り入れながら、より効率的な Web サイト構築を進めることができるでしょう。
原文を表示
Shopify/liquid: Performance: 53% faster parse+render, 61% fewer allocations
PR from Shopify CEO Tobias Lütke against Liquid, Shopify's open source Ruby template engine that was somewhat inspired by Django when Tobi first created it back in 2005.
Tobi found dozens of new performance micro-optimizations using a variant of autoresearch, Andrej Karpathy's new system for having a coding agent running hundreds of semi-autonomous experiments to find new effective techniques for training nanochat.
Tobi's implementation started two days ago with this autoresearch.md prompt file and an autoresearch.sh script for the agent to run to execute the test suite and report on benchmark scores.
The PR now lists 93 commits from around 120 automated experiments. The PR description lists what worked in detail - some examples:
Replaced StringScanner tokenizer with String#byteindex. Single-byte byteindex searching is ~40% faster than regex-based skip_until. This alone reduced parse time by ~12%.
Pure-byte parse_tag_token. Eliminated the costly StringScanner#string= reset that was called for every {% %} token (878 times). Manual byte scanning for tag name + markup extraction is faster than resetting and re-scanning via StringScanner. [...]
Cached small integer to_s. Pre-computed frozen strings for 0-999 avoid 267 Integer#to_s allocations per render.
This all added up to a 53% improvement on benchmarks - truly impressive for a codebase that's been tweaked by hundreds of contributors over 20 years.
I think this illustrates a number of interesting ideas:
- Having a robust test suite - in this case 974 unit tests - is a massive unlock for working with coding agents. This kind of research effort would not be possible without first having a tried and tested suite of tests.
- The autoresearch pattern - where an agent brainstorms a multitude of potential improvements and then experiments with them one at a time - is really effective.
- If you provide an agent with a benchmarking script "make it faster" becomes an actionable goal.
- CEOs can code again! Tobi has always been more hands-on than most, but this is a much more significant contribution than anyone would expect from the leader of a company with 7,500+ employees. I've seen this pattern play out a lot over the past few months: coding agents make it feasible for people in high-interruption roles to productively work with code again.
Here's Tobi's GitHub contribution graph for the past year, showing a significant uptick following that November 2025 inflection point when coding agents got really good.

He used Pi as the coding agent and released a new pi-autoresearch plugin in collaboration with David Cortés, which maintains state in an autoresearch.jsonl file like this one.
Via @tobi
Tags: django, performance, rails, ruby, ai, andrej-karpathy, generative-ai, llms, ai-assisted-programming, coding-agents, agentic-engineering, november-2025-inflection, tobias-lutke
関連記事
News to Guide
ニュースの次に確認する
発表内容を、現在の料金や仕様と照らし合わせられる関連ガイドです。
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み