EuroPython 2017

Executing scripts in a few milliseconds with MicroPython

Speaker(s) Marwan Al-Sabbagh

Command execution time can become important in a number of applications. Commands executed in command-line completion need to execute in less then 100ms or users will perceive a delay. In Shell scripting one might want to execute commands repeatedly in a for loop and fast execution times makes this more feasible.

Python is a very powerful language but has a much slower startup time compared to other interpreted languages like Perl, Lua and Bash. It can take up to 10 times longer to startup then some of these other languages.

MicroPython was written as a lean implementation of Python 3 with a small subset of the standard library mainly intended to run on microcontrollers. But it happily runs on Unix systems with excellent startup performance, making it an ideal candidate for implementing certain time sensitive commands.

This talk will:

  1. Explain when achieving fast execution times matters and when it doesn’t.

  2. Present two different approaches to measuring command execution time, one simple and the other more detailed and accurate.

  3. Compare execution times of a simple set of scripts that add two numbers in an number of different interpreted languages (micropython, python3, awk, perl, lua, bash).

  4. Present an example use case of MicroPython on Unix. Bash completion for pip install that completes the names of available packages live from a remote pypi mirror.

  5. Demonstrate the auto completion script with pip on a local pypi mirror.

in on Friday 14 July at 15:45 See schedule

Do you have some questions on this talk?

New comment