The Surprisingly Fast Way to Find Vowels in Strings

2025-06-13
The Surprisingly Fast Way to Find Vowels in Strings

This article benchmarks eleven different methods for detecting vowels in strings, from simple loops to regular expressions and even a prime number-based approach. Surprisingly, regular expressions consistently outperform other methods, even simple loops, across various string lengths. A deep dive into Python bytecode and the CPython regex engine reveals the reason for regex's speed. The author concludes that while regex is fastest for most cases, simpler methods suffice unless dealing with millions of strings.

Read more
Development string processing

Say Goodbye to Expensive Geocoding APIs: A Lightweight JavaScript Library for State/Province Lookup

2025-06-04
Say Goodbye to Expensive Geocoding APIs: A Lightweight JavaScript Library for State/Province Lookup

A startup spent thousands annually on the Google Maps API for reverse geocoding, just to determine users' states. Finding this wasteful, the author built `coord2state`, a lightweight JavaScript library that directly identifies US states from latitude/longitude coordinates. Leveraging US Census Bureau border data and the Douglas-Peucker algorithm for simplification, it achieves 99.9% accuracy at a 0.01° tolerance, weighing in at only 260KB. The library is open-sourced on GitHub and NPM, offering a cost-effective alternative for developers.

Read more

A 25-Year Odyssey in AI/ML: From Games to Program Synthesis

2025-01-02
A 25-Year Odyssey in AI/ML: From Games to Program Synthesis

This post recounts a 25-year journey in AI/ML. It begins with simple games in VB6, progressing to using state machines and higher-order functions to enhance game dynamics. Graduate studies introduced first-order logic, support vector machines, and neural networks, applied to projects like low-bandwidth video chat and code editor log analysis. As a professor, the author focused on intelligent developer tools, exploring predictive models to identify and correct programmer misconceptions. His work at Microsoft's program synthesis team involved LLMs to improve code assistance. The author emphasizes the importance of thoughtful AI application, prioritizing clear user problems and avoiding over-reliance on LLMs.

Read more