Execution Time Comparison

This is a link to a quick and dirty timer that compares the execution speed of equivalent-ish JavaScript and Python (via PyScript) functions. We know Python is slower. This gives a very rough and limited idea of how much slower, at least with these functions. I will admit I have very little JS knowledge, so if you see I have introduced things in either script that skew the results, please let me know.

JS/PyS Timer

1 Like

Your demo is very interesting. I was not aware that you could call PyScript and JavaScript functions from the same DOM element event.

<button type="submit" id="both_btn" name="both_btn" pys-onclick="py_run" onClick="js_run()" p>Go!</button>

2 Likes

I wasn’t either. As a hobbyist with no formal background in coding, I often just throw things against a wall and see what sticks (at least when I’m too lazy to venture over to StackOverflow).

2 Likes