2022 Week 32 in Review
planted on in: Week In Review.
~398 words, about a 2 min read.
"Freedom is the only worthy goal in life. It is won by disregarding things that lie beyond our control."
— Epictetus
This week has been spent split between a Node.js project and Laravel. The Node project uses Fasifty with Prisma and Redis to build a service for our routing engine to be hosted on aws lambda.
The project itself is going well, coming from PHP there was a huge shift in mindset needed at the beginning as building for lambda comes with its own constraints. When making requests for example I kept hitting a delay of two seconds before each request would process.
Using the JavaScript Performance measurement APIs I was able to nail this down to the first database query. It's a simple query and ran in about 500ms within TablePlus, even quicker at 23ms once I added an index on the two columns being filtered, so why the ~2000ms delay?
It turns out the delay is the Prisma.js cold boot time. This is compounded by the fact that I am booting Prisma for each request meaning it ends up garbage collected rather than remaining in global scope for all requests to utilise. The solution I have yet to implement is writing a Fastify Plugin to instantiate and expose the Prisma Client instance. The cold boot time will still be there but importantly; it won't be felt by every single request.
Joke of the week
"Why did the scarecrow win an award? Because he was the best in his field."
Notable Articles Read
- Jakob Greenfeld: No more "Insight Porn"
- Joe Morrison: Google Maps' Moat is Evaporating
- Ben Hoyt: Rob Pike’s simple C regex matcher in Go
- Keunwoo Lee: On rebooting: the unreasonable effectiveness of turning computers off and on again
- Adrian Holovaty: Let websites framebust out of native apps
Notable Videos Watched
- 4 EASY Starter Farms For 1.19 Survival Minecraft! by Gorillo
- Minecraft | How to Build a Barn for Animals by Zaypixel
Cool things from around the internet
- Radio Art Zone
- Hot: a macOS menu bar app for displaying temperatures
- luxe: A lovingly crafted cross platform game engine
- PHP Desktop