summaryrefslogtreecommitdiff
path: root/docs/reference
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2025-07-17 15:04:14 +1000
committerDamien George <damien@micropython.org>2025-07-23 11:37:16 +1000
commit677a0e01248bc7075f342c7df9671b006bf76c89 (patch)
tree6be1aa0227ab28d3e3db260706951c40f97d3b51 /docs/reference
parentb070765427283fd994f217b8c7601ef9b1f9a37a (diff)
docs/reference/speed_python: Document schedule/GIL limitation of native.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'docs/reference')
-rw-r--r--docs/reference/speed_python.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/reference/speed_python.rst b/docs/reference/speed_python.rst
index 64fd9df6c..9360fd610 100644
--- a/docs/reference/speed_python.rst
+++ b/docs/reference/speed_python.rst
@@ -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).
* Generators are not supported.
* 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
increase in compiled code size.