generateQRCode() causes initial stuttering, despite calls to coroutine.yield()


I realize generateQRCode() is ungodly slow on device (takes around 10 seconds) but I'm using it at runtime to generate unique URLs with the player's score and uuid. However, I noticed that no matter what I do, the initial call causes the next few frames to stutter noticeably more than the others.

I was hoping that calling coroutine.yield() after generateQRCode() would be a "quick fix" but it doesn't look like the QR code does any generation while yielding, even for several seconds.

Ideally the QR code would still generate/do it's thing while I'm yielding to help mask the stuttering, but instead I found it awkward to workaround by having to draw a solid black screen for a few frames, eg during a game screen transition.