This 15KB Text Engine Runs Mario at 1200x Speed and Shakes Web Development

The frontend development world just got shaken to its core. A tiny open-source project called Pretext has exploded across the internet, racking up over sixteen hundred stars on GitHub in a single day. What makes it special is not what it adds to web development, but what it removes.

Pretext is a text rendering engine that weighs just fifteen kilobytes. Yet it achieves something that browser engineers have struggled with for three decades. It renders complex user interfaces directly in text, bypassing the traditional document object model entirely, and it does so at speeds that make conventional approaches look like they are standing still.

The numbers are staggering. In benchmark tests, Pretext renders text up to twelve hundred times faster than traditional DOM-based approaches. It maintains a smooth one hundred twenty frames per second even when handling massive amounts of text. For context, most web applications struggle to maintain sixty frames per second with far less demanding workloads.

But speed is only part of the story. The real magic is what developers are doing with it.

Within hours of the project going public, developers started building things that should not be possible in plain text. Someone created a fully playable version of the classic Super Mario game, running entirely inside a text block. Others built Tetris, Snake, and even a version of the famous Bad Apple animation, all rendered with nothing but text characters.

The creator behind this project is Cheng Lou, a frontend engineer who previously worked at Midjourney and has a long history of building influential tools in the JavaScript ecosystem. He is best known as the creator of React Motion, a popular animation library, and as a key contributor to ReasonML and ReScript. He also worked on the frontend architecture for Facebook Messenger.

According to Lou, the idea came from a simple frustration. He had just finished a project and was thinking about the future of user interfaces. He realized that one of the biggest bottlenecks in modern web development is something most developers take for granted. The browser’s text rendering system.

For thirty years, web browsers have rendered text using the same basic approach. When text changes, the browser recalculates the layout of the entire page. This process, called reflow, is expensive. It gets worse when text is dynamic, when fonts change, or when multiple languages are involved. In complex applications, a single text update can trigger a cascade of recalculations that bring the interface to a crawl.

Lou’s breakthrough was surprisingly simple in concept. He realized that the browser’s Canvas API has a method called measureText that can calculate the exact dimensions of text without ever touching the DOM. By using this method, he could lay out entire text-based interfaces without triggering a single reflow.

The approach works like this. Instead of creating DOM elements for every piece of text, Pretext draws everything directly to a canvas. Each character becomes a pixel-like unit. Once drawn, the text stays fixed. Resizing the window, scrolling, or animating does not force the browser to recalculate anything. The result is rendering performance that traditional approaches simply cannot match.

The performance gains are not theoretical. In one demonstration, Pretext renders a massive wall of text at one hundred twenty frames per second without dropping a single frame. The same content rendered with traditional DOM methods struggles to reach ten frames per second. The difference is not incremental. It is transformative.

What makes this even more impressive is the size. The entire engine fits in fifteen kilobytes. That is smaller than most images on a typical webpage. Yet it handles complex layout scenarios that full-featured UI frameworks struggle with. Multi-language text, bidirectional writing, dynamic resizing, and real-time animations all work out of the box.

The project was built with significant help from artificial intelligence. Lou used Claude Code and Codex to handle much of the implementation. He described the process as a collaboration, where he provided the architectural vision and the AI tools handled the detailed coding. The result suggests that AI-assisted development is reaching a level where it can produce production-quality infrastructure code.

The community response has been explosive. Developers have pushed the engine far beyond what its creator originally imagined. One developer created a particle system that runs entirely in text, with thousands of individual characters moving and interacting in real time. Another built a physics simulation where bouncing objects are rendered as ASCII characters.

Perhaps the most impressive demonstration is a version of the Bad Apple animation, a famous test of rendering capability in developer communities. The animation, which features complex silhouettes and rapid scene changes, runs smoothly in Pretext using nothing but text characters to represent each frame.

The technical foundation of Pretext reveals the depth of thinking behind the project. Lou drew inspiration from an experimental project called text-layout that Sebastian Markbage of the React team created ten years ago. That project explored the idea of using canvas-based text measurement to avoid DOM overhead, but it never became a production tool. Lou took the core insight and built a complete rendering engine around it.

The implications for web development are significant. For thirty years, the browser’s text rendering pipeline has been a black box that developers could not optimize. CSS provides some control, but the underlying layout engine remains a performance bottleneck. Pretext proves that there is another way. By bypassing the DOM entirely, developers can achieve performance that was previously impossible.

Some developers are already calling this a paradigm shift. The traditional model of web rendering, where HTML elements are created, styled, and manipulated through the DOM, may not be the only way forward. For applications where text performance matters, such as terminals, code editors, data dashboards, and chat interfaces, Pretext offers a fundamentally different approach.

The project has passed rigorous cross-browser testing. It runs correctly on Chrome, Safari, and Firefox, handling over seven thousand six hundred concurrent test cases. This level of compatibility is unusual for such a young project and suggests that the approach is solid enough for real-world use.

What is perhaps most surprising is how small the codebase is. Fifteen kilobytes is smaller than most JavaScript utility libraries. Yet Pretext handles text layout, rendering, animation, and interaction. It supports features like word wrapping, text alignment, cursor positioning, and selection. All of this in a package that loads almost instantly.

The community has responded with a wave of creative projects. Developers have built interactive games, animated visualizations, and even 3D effects using only text characters. One project renders a rotating three-dimensional globe using ASCII characters. Another creates a particle explosion effect where each particle is a letter or symbol.

A developer named Marius Hauken recreated the classic Breakout game using Pretext, demonstrating that even action games with real-time collision detection can run smoothly in a text-based environment. Another developer built a Snake game that runs at full speed with no perceptible lag.

Perhaps the most mind-bending demonstration involves machine learning. Someone trained a neural network to play games within the Pretext environment. The AI learns to navigate mazes, avoid obstacles, and optimize its path, all while the game state is rendered as plain text. The combination of high-performance text rendering and artificial intelligence opens possibilities that few had considered before.

There is even a version that creates a 3D spinning cube effect using nothing but carefully arranged text characters. The illusion of depth and rotation is remarkably convincing, considering that every pixel is actually a letter or number.

Beyond the demos and games, Pretext represents something larger. It challenges a fundamental assumption about web development. For decades, developers have accepted that text rendering is slow, that the DOM is inevitable, and that complex text layouts require heavy frameworks. Pretext proves that none of these assumptions are necessarily true.

Lou himself sees Pretext as more than a rendering engine. In his vision, it is a foundational layer for a new kind of user interface architecture. As web applications become more complex, the cost of DOM manipulation grows. The traditional approach of creating, updating, and destroying HTML elements does not scale well for high-frequency updates. Pretext offers an escape hatch.

The project is already attracting attention from major technology companies. Lou’s track record certainly helps. As the creator of React Motion and a contributor to some of the most influential frontend tools of the past decade, he has earned the benefit of the doubt. When Cheng Lou builds something, developers pay attention.

Whether Pretext becomes a mainstream tool or remains a niche solution for specific use cases, it has already achieved something important. It has shown that the browser is capable of far more than we assumed. It has demonstrated that text, the most basic element of computing, can be a medium for high-performance graphics and interaction. And it has proven that sometimes the most powerful innovations come not from adding complexity, but from removing it.

In a world where frontend frameworks keep growing larger and more complex, a fifteen-kilobyte engine that outperforms everything else is a reminder that simplicity still matters. Sometimes the best way to move forward is to go back to basics.