Standard Library

@micropython.native

This causes the MicroPython compiler to emit native CPU instructions rather than the VM bytecode, skipping the interpreter. Most functions require no adaptation.

@micropython.viper

Does a similar thing as the Native code emitter, except it applies some further optimisations that substantially increase performance for integer arithmetic and manipulations.


Viper provides pointer types to assist the optimiser.

Also Viper ints are 32-bit machine integers that wrap on overflow, unlike Python’s unlimited integers.

The same python code can drastically give different results in Viper.

MicroPython

<

12

>