Skip to content
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

MICROPY_QSTR_BYTES_IN_HASH performance/size tradeoff #10151

Open
dhalbert opened this issue Mar 19, 2025 · 0 comments
Open

MICROPY_QSTR_BYTES_IN_HASH performance/size tradeoff #10151

dhalbert opened this issue Mar 19, 2025 · 0 comments

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.

@dhalbert dhalbert added this to the Long term milestone Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant