Mojo Mania Repos

Hi folks,

I created a GitHub org where I consolidate all the Mojo experiments I’ve built over the years. I called it Mojo Mania: Mojo Mania · GitHub

Six repos are up so far. Each one is a pixi project with tests, benchmarks against whatever the stdlib offers, and CI on Linux and macOS.

mm_mmap ( GitHub - Mojo-Mania/mm_mmap: POSIX memory mapping for Mojo · GitHub ) — POSIX memory mapping. An owning MemoryMap that maps a file or fresh anonymous memory, plus the mmap/munmap/msync bindings and typed Prot/MapFlags flags. This one started life as a stdlib PR, which has since been reopened — so it may well land upstream at some point. Until it does, it lives here.

mm_fiby_tree ( GitHub - Mojo-Mania/mm_fiby_tree: A sorted set for Mojo, backed by a binary search tree held in parallel arrays · GitHub ) — a sorted set backed by a binary search tree in parallel arrays. Nodes are indices into two owned buffers rather than individual allocations, so a whole set is two allocations and a 56-byte handle. Balancing is by rebuilding into level order.

mm_rb_tree ( GitHub - Mojo-Mania/mm_rb_tree: A sorted set for Mojo, backed by a red-black tree. · GitHub ) — the same storage design, red-black balancing instead. Worth having both: on randomly ordered input they’re level, but on sorted-ish input the red-black one is about twice as fast, which the benchmarks show.

mm_lcrs_tree ( GitHub - Mojo-Mania/mm_lcrs_tree: An n-ary tree for Mojo, stored as left-child / right-sibling links in parallel arrays. · GitHub ) — an n-ary tree stored as left-child / right-sibling links, so a node costs the same two links no matter how many children it has.

mm_string_dict ( GitHub - Mojo-Mania/mm_string_dict: A hash map from string keys to arbitrary values for Mojo, with the keys stored compactly. · GitHub ) — a string-keyed hash map that packs the keys end to end in one buffer with a parallel array of offsets, so a key costs its bytes plus one offset — no per-key header and no per-key allocation. It’s a Swiss table with SIMD group probing. Measured across twelve real word lists it comes out around half the memory of Dict[String, Int].

mm_hmac ( GitHub - Mojo-Mania/mm_hmac: HMAC-SHA256 and SHA-256 for Mojo, in plain Mojo, with no dependencies — no FFI, no C library, no third-party package. · GitHub ) — HMAC-SHA256 and SHA-256 in plain Mojo with no dependencies. It compiles to whatever SHA acceleration the target has — ARMv8 crypto extensions, x86-64 SHA-NI, or a portable fallback — picked at compile time so only one core is instantiated. 2.5 GB/s on Apple Silicon. Checked against the FIPS and RFC 4231 vectors.

I’m not done. There are a few more experiments I haven’t pushed yet, and I’ll keep adding as I clean them up.

Two things I’d love input on.
I’m thinking about starting a YouTube channel alongside this — systems programming in Mojo, taken slightly less seriously. Talking through the experiments probably with some funny code reviews thrown in, including of my own code, which gives me plenty of material.

And I’d really like to record with other people rather than just talk at a camera on my own. Pairing on an experiment, reviewing each other’s code, arguing about whether a benchmark is fair. If you work in Mojo and fancy doing an episode together, get in touch. Same goes if you have an idea for something worth covering.

Cheers

2 Likes

Hello, i’m very happy you are thinking about doing an youtube channel.
Having somebody knowledgable like you live on the air is very important.
Support: 100% :white_check_mark:

I would not mind at all appearing and participating in the effort,
pretty sure many people in the community would too.
(we already did quite an few audio/video meeting on the chat)

1 Like