Purple Garden Lexer Optimization: A Speed Boost from 0 to 580MB/s
This blog post details the author's journey in optimizing the Purple Garden language's lexer, achieving an impressive speed of 580MB/s. Techniques employed include computed gotos, zero-copy zero-allocation strings, an allocator interface, token interning, and pre-computed keyword hashes, significantly improving lexer performance. Further optimizations involved architectural improvements and using mmap for faster file reading. These optimizations resulted in a dramatic speed increase, transforming processing time from tens of milliseconds to mere milliseconds—a true leap in speed.
Read more