# A Fast Bytecode VM for Arithmetic: The Virtual Machine

**URL:** <https://discourse.haskell.org/t/a-fast-bytecode-vm-for-arithmetic-the-virtual-machine/13159>\
**Category:** Links\
**Created:** [October 21, 2025, 3:14pm UTC](https://discourse.haskell.org/t/a-fast-bytecode-vm-for-arithmetic-the-virtual-machine/13159 "2025-10-21T15:14:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhin4v](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/abhin4v/32/1234_2.png) [@abhin4v](https://discourse.haskell.org/u/abhin4v)\
**Post date:** [October 21, 2025, 3:14pm UTC](https://discourse.haskell.org/t/a-fast-bytecode-vm-for-arithmetic-the-virtual-machine/13159/1 "2025-10-21T15:14:48Z")

</div>

> **[A Fast Bytecode VM for Arithmetic: The Virtual Machine](https://abhinavsarkar.net/posts/arithmetic-bytecode-vm/)**
>
> We write a fast bytecode VM for arithmetic in Haskell.

---

<div class="post-metadata">

**Author:** ![jaror](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/jaror/32/3271_2.png) [@jaror](https://discourse.haskell.org/u/jaror)\
**Post date:** [October 21, 2025, 6:19pm UTC](https://discourse.haskell.org/t/a-fast-bytecode-vm-for-arithmetic-the-virtual-machine/13159/2 "2025-10-21T18:19:14Z")

</div>

> In short, GHC has turned our high-level, declarative Haskell code into a low-level loop that looks remarkably like one we would write in C. We get the safety and expressiveness of Haskell, while GHC does the heavy lifting to produce highly optimized code. It’s the best of both worlds!

Neat!

> we could replace our Attoparsec-based combinator parser with a parser generator like [Alex](https://www.haskell.org/alex/) and [Happy](https://www.haskell.org/happy/), or even write a raw recursive-descent parser by hand.

I’d recommend looking at [`flatparse`](https://github.com/AndrasKovacs/flatparse). It is 6x faster than `attoparsec` on microbenchmarks.
