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

mpy-cross bytecode optimizations level ?!? #5392

Closed
jedie opened this issue Dec 7, 2019 · 4 comments
Closed

mpy-cross bytecode optimizations level ?!? #5392

jedie opened this issue Dec 7, 2019 · 4 comments

Comments

@jedie
Copy link
Contributor

jedie commented Dec 7, 2019

The mpy-cross help or https://github.com/micropython/micropython/blob/master/mpy-cross/README.md does not describe which optimizations level exist. And what the levels do.

I notice that the optimizations level, set with -O, changes the information in tracebacks. At higher levels, for example, the code line number is always 0.

Is there more detailed information about this somewhere?

I also ask here:

@jimmo
Copy link
Member

jimmo commented Dec 7, 2019

See #5393

The optimisation level is the same as setting micropython.opt_level which is documented at http://docs.micropython.org/en/latest/library/micropython.html#micropython.opt_level

@jedie
Copy link
Contributor Author

jedie commented Dec 7, 2019

Thanks! I will close this for #5393

@jedie jedie closed this as completed Dec 7, 2019
@jedie
Copy link
Contributor Author

jedie commented Dec 7, 2019

I looked at: http://docs.micropython.org/en/latest/library/micropython.html#micropython.opt_level

reopen this issues, because I miss the highest value. I see only:

levels 3 and higher

So there must exists a level 4 ?

And another question: What's about DocStrings and doc: Will they be always striped?

@jedie jedie reopened this Dec 7, 2019
@jimmo
Copy link
Member

jimmo commented Dec 7, 2019

So there must exists a level 4 ?

Any optimisation behaviour is enabled at the given level, and any higher levels. But in reality it's just a number... so I guess a level 4 could be added in the future (which included all O1, O2, O3 optimisations) but currently the highest level used is 3. If you grep the codebase for mp_optimise_value you can see them.

And another question: What's about DocStrings and doc: Will they be always striped?

The behaviour of docstrings (and the __doc__ attribute) is controlled by the MICROPY_ENABLE_DOC_STRING configuration option (and it's disabled by default).

So yes, docstrings are always stripped regardless of the optimisation flag (this applies to both mpy-cross and the on-board compiler).

@jimmo jimmo closed this as completed Dec 7, 2019
tannewt added a commit to tannewt/circuitpython that referenced this issue Oct 13, 2021
allow usb_hid.Device(..., report_ids=(0,), ...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants