Who will build the Mojo of JavaScript?
The world of AI and web development often seem like two separate universes. But what if they converged or one would learn from the other?
Modular's creation, Mojo, has stirred the AI developer community with its fresh approach. Designed to unify AI infrastructure, Modular made some astute observations:
The Complexity of AI Frameworks: PyTorch and Tensorflow, while powerful, have hardcoded optimizations that are challenging to maintain. Kernel fusions, combining kernels such as matrix multiplication and ReLu into one, but also hardcoded optimizations for specific hardware.
The N-World Problem: Building AI applications often involves juggling between Python, C/C++, Cuda, and more. Debugging across these boundaries can be a nightmare.
Hand-writing MLIR: Modular developers found themselves handwriting a lot of MLIR, which is a new intermediary compiler representation of LLVM that Modular bets on. Handwriting MLIR can be cumbersome - a higher level abstraction is needed.
Humans need to specialize: We humans have limited capacity and need to specialize. Not one person can be world-class at building compilers, researching LLMs, and building hardware at the same time. (Maybe George Hotz is - we’ll see what comes out of tinycorp)
CPUs are overlooked: In AI, CPUs are a rather overlooked accelerator in AI, although modern CPUs are getting more and more capabilities that are accelerator-like.
These observations led Modular to build Mojo - a superset of Python. That means it's fully Python-compatible but brings some extra stuff on top.
What is that extra stuff?
Rust-inspired systems programming, allowing to directly target MLIR
Zig-inspired compile-time metaprogramming, making it easy to target specific architecture
For more, check out their docs
In other words - it lets you mix low-level, statically typed code, with good ol’ dynamic Python, all in one language, without having to go for C/C++.
On the other edge of the software universe, the web development front, JavaScript and TypeScript dominate. However, as abstractions solidify, there's a shift towards rewriting performance-sensitive code like parsers in languages that offer low-level system access, such as Go, Rust, and Zig. The performance benefits of this shift are undeniable (esbuild, swc, bun, …). But what if we could enjoy these benefits without the chaos of juggling multiple languages?
Imagine a Mojo-like language for JavaScript or TypeScript. Developers could start with TypeScript and gradually delve deeper, optimizing performance without shifting languages. Furthermore, an in-built auto-optimizer could use machine learning to enhance builds for specific hardware configurations such as it is the case for Mojo.
Such a language could revolutionize web development. Mojo is making projects like ggml and tinygrad redundant in the AI ecosystem by addressing performance issues at a foundational level. Which projects in web development could this language make redundant?
The potential for a unified programming paradigm is immense. While the challenges are significant, the rewards could redefine how we approach web development. Who will build the Mojo of JavaScript?