Repository navigation
refactor: Simplify the codebase and reduce memory and SVG size - #3
Merged
Merged
Conversation
The compiled application already records the gleam.toml version, so the Docker image no longer needs a version file and an entrypoint wrapper to pass it through MAYU_VERSION.
Both routes increment, so the name now says so. The demo counter is a request rule rather than storage behaviour.
Image header parsing had one caller, and the hidden-theme suffix was checked separately by the picker and the default selection.
Repeated digits now reference one embedded image through <use>, which cuts a padded counter such as 0000001 from 10,550 to 3,429 bytes. IDs come from a hash of the image bytes, so counters inlined into one page can only share an ID when the images are identical.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove the broken Nix package and unused code, rename database and theme code to match what it does, and cut idle memory and the size of padded counters. Prepare
0.2.0, which dropsMAYU_VERSIONand the Nix package but keeps counter behaviour and stored data unchanged.Changes
index.htmlor themes and crashed when started outside a checkout. The flake keeps a development shell fornix develop.MAYU_VERSION, the.mayu-versionfile, and the Docker entrypoint wrapper.get_countertoincrement, because both counter routes increment, and move thedemorule into the request handler.Counter.numtocount. The JSON key remainsnum.cacheandimagemodules intotheme, and check the hidden-theme suffix in one function.<use>. Image IDs come from a hash of the image bytes, so counters inlined into one HTML page share an ID only when their images are identical.ERL_FLAGS="+P 262144 +Mea min"in the Docker image to shrink the process table and allocator overhead./heart-beatas plain text.0.2.0.Compatibility
This change has no database migration or schema change. Databases written by
0.1.29keep counting under0.2.0on SQLite and PostgreSQL, and0.2.0keeps the PostgreSQL integer widening from0.1.28. Counter routes, increment semantics, name encoding, and response caching stay the same.These changes can affect existing deployments:
MAYU_VERSIONand shows the version fromgleam.toml.nix runno longer works. Docker is the supported package./heart-beatreturnstext/plaininstead oftext/html. The body is stillalive.ERL_FLAGSreplaces the image's memory flags.<defs>and<use>. This affects only tools that parse the SVG.Validation
fuwn/mayu:0.1.29image created data on SQLite and PostgreSQL. After the upgrade, that data kept its counts, encoded names, and timestamps.0000001shrank from 10,550 to 3,429 bytes. A count without repeated digits grows by about 4%, and each render takes up to 0.4 microseconds longer.