wc2

v 20221102 Updated: 5 months ago

Investigates optimizing 'wc', the Unix word count program

There have been multiple articles lately implementing the classic wc program in various programming languages, to "prove" their favorite language can be "just as fast" as C. This project does something different. Instead of a different language it uses a different algorithm. The new algorithm is significantly faster -- implementing in a slow language like JavaScript is still faster than the original wc program written in C. The algorithm is known as an "asynchronous state-machine parser". It's a technique for parsing that you don't learn in college. It's more efficient, but more importantly, it's more scalable. That's why your browser uses a state-machine to parse GIFs, and most web servers use state-machiens to parse incoming HTTP requests.

https://github.com/robertdavidgraham/wc2

To install wc2, paste this in macOS terminal after installing MacPorts

sudo port install wc2

Add to my watchlist

Installations 0
Requested Installations 0