Let's face it.
Python is cool, and it has been so for a quarter century.
It's got maybe the best syntax out there, as far as programming language go, which makes it perfect to translate ideas into code.
It's got a library for almost everything, and if you know C++, it is trivially easy to create bindings for your C/C++ library. I'm not a C++ expert, yet I made a binding for a pet project of mine which is going to be featured here Real Soon Now(tm).
It's the perfect glue language.
It's... an Uncle Scrooge's Bin-sized bundle of goodness.
However, it's also got limits. One of these is that it's not a natively compiled language. Which means that, on average, pure python solutions are definitelty slower and need more RAM.
This might be the case for Fakedown. It is a simple, innocent-looking web app... However, it encapsulates an object that, in its current implementation, mantains a Markov Chain made out of a whole novel in memory.
Loading this and creating the Markov chain translates into 106 meg of memory occupation.
On a run-of-the mill developer's machine this is not a big deal. It's not a big deal even on a 13-years old laptop (like my son's).
However, if you deploy it into a constrainted machine (like, say, a small VPS)... then the memory footprint becomes important.
That's where Fakegown comes in.
It does the same thing Fakedown, only it is written in Go.
I'm no expert in that language, but I've been tinkering with it in my spare time, and converting my markdown engine from Python to Go might be quite a nice exercise, because you happen to touch real-world stuff (like building a text-only web api) but, at the same time, there are no overly complex algorithm to convert.
Got to say that I'm quite happy with it. Memory consumption has gone down from 106 meg to 24-31 - a 70% net gain. Moreover, the web app is definitely faster.
So, if you need a Markov chain engine to play with and you want speed and performance, get Fakegown.
Resources
- Markov
A simple Markov Chain library made in go.
- Fakegown
A test web app for my Markov chain library, modelled upon https://github.com/maxlambertini/fakedown .
20 Dec 2021