# Execution Time Comparison

**URL:** <https://forum.anaconda.com/t/execution-time-comparison/30632>\
**Category:** PyScript\
**Created:** [August 8, 2022, 2:44pm UTC](https://forum.anaconda.com/t/execution-time-comparison/30632 "2022-08-08T14:44:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark.d.lattimore](https://dub1.discourse-cdn.com/anaconda/user_avatar/forum.anaconda.com/mark.d.lattimore/32/1854_2.png) [@mark.d.lattimore](https://forum.anaconda.com/u/mark.d.lattimore)\
**Post date:** [August 8, 2022, 2:44pm UTC](https://forum.anaconda.com/t/execution-time-comparison/30632/1 "2022-08-08T14:44:09Z")

</div>

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](https://mdlattimore.github.io/pyscript_playground/timing)

---

<div class="post-metadata">

**Author:** ![john.hanley](https://dub1.discourse-cdn.com/anaconda/user_avatar/forum.anaconda.com/john.hanley/32/1294_2.png) [@john.hanley](https://forum.anaconda.com/u/john.hanley)\
**Post date:** [August 8, 2022, 8:26pm UTC](https://forum.anaconda.com/t/execution-time-comparison/30632/2 "2022-08-08T20:26:52Z")

</div>

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>`

---

<div class="post-metadata">

**Author:** ![mark.d.lattimore](https://dub1.discourse-cdn.com/anaconda/user_avatar/forum.anaconda.com/mark.d.lattimore/32/1854_2.png) [@mark.d.lattimore](https://forum.anaconda.com/u/mark.d.lattimore)\
**Post date:** [August 8, 2022, 8:39pm UTC](https://forum.anaconda.com/t/execution-time-comparison/30632/3 "2022-08-08T20:39:00Z")

</div>

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).
