Skip to content

Instantly share code, notes, and snippets.

C vs. Python and the Dynamics of the Acrobot

A new quick test. The benchmarking task was to simulate the dynamics of an acrobot for 100 steps ($\Delta t= 0.05$). The state and the current acrobot state is printed in the standard output.

The C program does not use any kind of optimization. The Python program has several versions: the robot physical parameters are passed as a dictionary, independently as float, independently as float with numba optimization. Also a test without output for see the overhead. The results show the

Membership Function Benchmark

Quick test to compare execution time of the triangular fuzzy membership function in several programming languages with two different versions. The code is shown in Julia but it was used equivalent code in other languages. The function is called 10 billion times in the body of a loop. The returned value is added to a variable to avoid possible compiler optimizations.

The first versions is a compact, mathematical approach as follows: