Optimize jsmntok_t memory footprint via configurable field types - #248
Open
metalalive wants to merge 1 commit into
Open
Optimize jsmntok_t memory footprint via configurable field types#248metalalive wants to merge 1 commit into
jsmntok_t memory footprint via configurable field types#248metalalive wants to merge 1 commit into
Conversation
Signed-off-by: T.H. <7197142+metalalive@users.noreply.github.com>
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.
Description
This patch introduces build-time configuration macros for
jsmntok_tfield types to reduce memory usage onresource-constrained targets as described in the issue 239.
Changes
JSMN_TOKEN_START_TYPE) with default fallback toint.jsmntok_tstruct to utilize these macros, allowing users to override types (e.g.,short,int8_t) beforeincluding
jsmn.h.jsmntype_ttype to the end of the struct and applied bit-field sizing (: 8) to improve struct packing and alignment.README.mdwith usage examples for memory-constrained environments.Impact
Size of a
jsmntok_tinstance can be reduced , enabling more token array items in limited RAM environments without changing the API.Test Result
I don't find any CI flow (GitHub Action ?) in this repo , allow me to post my test result at here .
make test with custom
config.mkmemory check with the test executable