docs/reference/speed_python: Document schedule/GIL limitation of native.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
b070765427
commit
677a0e0124
1 changed files with 7 additions and 0 deletions
|
|
@ -246,6 +246,13 @@ There are certain limitations in the current implementation of the native code e
|
||||||
* Context managers are not supported (the ``with`` statement).
|
* Context managers are not supported (the ``with`` statement).
|
||||||
* Generators are not supported.
|
* Generators are not supported.
|
||||||
* If ``raise`` is used an argument must be supplied.
|
* If ``raise`` is used an argument must be supplied.
|
||||||
|
* The background scheduler (see `micropython.schedule`) is not run during
|
||||||
|
execution of native code.
|
||||||
|
* On targets with thrteading and the GIL, the GIL is not released during
|
||||||
|
execution of native code.
|
||||||
|
|
||||||
|
To mitigate the last two points, long running native functions should call
|
||||||
|
``time.sleep(0)`` periodically, which will run the scheduler and bounce the GIL.
|
||||||
|
|
||||||
The trade-off for the improved performance (roughly twice as fast as bytecode) is an
|
The trade-off for the improved performance (roughly twice as fast as bytecode) is an
|
||||||
increase in compiled code size.
|
increase in compiled code size.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue