Crunk-QRcode: Fast QRCodes from Lua (C-Accelerated)

Hey all!

I just published my first open-source Lua C-Extension: crunk-qrcode.

It takes an MIT licensed QRCode generator written in C (qrcodegen.c), tweaks it to compile for Playdate and provides a Lua wrapper. This is fast enough to do real-time QRCode generation (no async callbacks required). Speed-up is 75-150x over the in the SDK, depending on length:

Length Lua C Speedup
16 1050ms 7ms 150x
100 2267ms 21ms 100x
254 3934ms 46ms 85x
1323 16114ms 214ms 75x

Here's a stupid demo where I regenerated the qrcode in realitime via crank.


I'd love to add that speed up! Hope to use it soon. Good job. Thx.

Looks like the colours are inverted, or is that okay? I don't seem to be able to scan it using Firefox on Android.

@thomastc Oops. That animated GIF is indeed inverted. It was from a pre-release version of the code.

Here's what the code in the repo produces:

Also funny because iOS will happily read the inverted code.

1 Like

Ohhh nice, that's amazing. I was specifically for an option to set error recovery level to low, because we're showing it on a digital screen anyways, no need to protect against torn paper.