Skip to content

MICROPY_QSTR_BYTES_IN_HASH performance/size tradeoff #10151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dhalbert opened this issue Mar 19, 2025 · 0 comments · Fixed by #10269
Closed

MICROPY_QSTR_BYTES_IN_HASH performance/size tradeoff #10151

dhalbert opened this issue Mar 19, 2025 · 0 comments · Fixed by #10269
Assignees
Milestone

Comments

@dhalbert
Copy link
Collaborator

MICROPY_QSTR_BYTES_IN_HASH says how many bytes to reserve for a qstr hash. Typical values are 0, 1, 2.

MicroPython uses 0 for the smallest builds causing a few % penalty in performance. See micropython#12835. MicroPython uses 2 for builds that are not cramped for space, and 1 for others.

CircuitPython uses 1 for everything.

Trinket build delta
0: -640
1: 0 (default)
2: +664

So changing to 0 for tiny builds will get us some extra space, if we need it in the future. I haven't seen a performance chart for 1 vs 2. We could consider 2 for some builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants