effigy.im
effigy.im copied to clipboard
Implement caching and improve PNG generation performance
This pull request was created by Sweep to resolve the following request by @harperreed:
- [ ] Optimize image generation
- [ ] Investigate using sharp for faster image processing
- [ ] Implement pre-generation and caching of common identicons
Continue chatting at https://sweep-chat-demo.vercel.app/c/00b4b9ad-d702-4e13-a3d0-db2efe14b1a6.
Purpose
This pull request aims to improve the performance and caching of the identicon generation functionality in the effigy.im
project.
Description
The key changes in this pull request are:
- Implemented a caching mechanism using the
node-cache
library to store generated identicons. This will reduce the need to generate new identicons on every request, improving overall response times. - Optimized the PNG identicon generation process by using the
sharp
library, which provides faster image processing compared to the previouspnglib
implementation. - Refactored the
blockiesPNG.js
module to use the newsharp
-based implementation, improving the overall code quality and maintainability.
Summary
The changes in this pull request include:
- Implemented a caching mechanism using
node-cache
infunctions/index.js
- Optimized the PNG identicon generation process using the
sharp
library infunctions/lib/blockiesPNG.js
- Refactored the
blockiesPNG.js
module to use the newsharp
-based implementation