{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os, sys\n", "import numpy as np\n", "import pandas as pd\n", "import json\n", "pd.options.mode.chained_assignment = None\n", "\n", "import plotly.graph_objects as go\n", "import plotly.io as pio\n", "import plotly.express as px\n", "from plotly.subplots import make_subplots\n", "from unicodeit import replace as tex_to_unis\n", "# sys.path.append(\"C:/Users/rurur/Desktop/p/python/plotly\")\n", "# import plotly_setup" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPython-3.11.txt CPython-3.11_full.txt CPython-3.9.txt CPython-3.9_full.txt Pyodide.txt PyPy-3.9-v7.3.13.txt PyPy-3.9-v7.3.13_full.txt Xeus.txt\n", "PyPy-3.9-v7.3.13 CPython-3.9 CPython-3.11 Pyodide Xeus\n" ] } ], "source": [ "result_files = os.listdir(\"./results\")\n", "result_titles = sorted(set([f.rstrip(\"full_.txt\") for f in result_files]))\n", "result_titles[0], result_titles[2] = result_titles[2], result_titles[0]\n", "print(*result_files)\n", "print(*result_titles)" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [], "source": [ "df = pd.DataFrame()\n", "funcs = [\"time_with_types\", \"time_no_types\", \"time_np\"]\n", "funcs_titles = [f.lstrip(\"time_\") for f in funcs]\n", "funcs_titles[-1] = \"numpy\"\n", "for rtitle in result_titles:\n", " with open(f\"results/{rtitle}.txt\", \"r\", encoding=\"utf-8\") as f:\n", " result = json.load(f)\n", " result_df = pd.DataFrame(dict(\n", " interpreter=result[\"interpreter\"],\n", " time=[result[func] for func in funcs],\n", " funcs=funcs_titles,\n", " test_mode=\"func\"\n", " ))\n", " df = pd.concat([df, result_df], ignore_index=True)\n", "\n", " fname_full_time = f\"{rtitle}_full.txt\"\n", " if fname_full_time in result_files:\n", " with open(f\"results/{fname_full_time}\", \"r\", encoding=\"utf-8\") as f:\n", " times = [float(line) for line in f.readlines()]\n", " result_df = pd.DataFrame(dict(\n", " interpreter=result[\"interpreter\"],\n", " time=times,\n", " funcs=funcs_titles,\n", " test_mode=\"full\"\n", " ))\n", " df = pd.concat([df, pd.DataFrame(result_df)], ignore_index=True)\n" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | interpreter | \n", "time | \n", "funcs | \n", "test_mode | \n", "
---|---|---|---|---|
0 | \n", "PyPy-3.9-v7.3.13 | \n", "0.099364 | \n", "with_types | \n", "func | \n", "
1 | \n", "PyPy-3.9-v7.3.13 | \n", "0.109924 | \n", "no_types | \n", "func | \n", "
2 | \n", "PyPy-3.9-v7.3.13 | \n", "3.676712 | \n", "numpy | \n", "func | \n", "
3 | \n", "PyPy-3.9-v7.3.13 | \n", "5.319000 | \n", "with_types | \n", "full | \n", "
4 | \n", "PyPy-3.9-v7.3.13 | \n", "3.638000 | \n", "no_types | \n", "full | \n", "
5 | \n", "PyPy-3.9-v7.3.13 | \n", "14.639000 | \n", "numpy | \n", "full | \n", "
6 | \n", "CPython-3.9 | \n", "1.445288 | \n", "with_types | \n", "func | \n", "
7 | \n", "CPython-3.9 | \n", "1.476920 | \n", "no_types | \n", "func | \n", "
8 | \n", "CPython-3.9 | \n", "1.407270 | \n", "numpy | \n", "func | \n", "
9 | \n", "CPython-3.9 | \n", "2.242000 | \n", "with_types | \n", "full | \n", "
10 | \n", "CPython-3.9 | \n", "1.502000 | \n", "no_types | \n", "full | \n", "
11 | \n", "CPython-3.9 | \n", "1.986000 | \n", "numpy | \n", "full | \n", "
12 | \n", "CPython-3.11 | \n", "0.820678 | \n", "with_types | \n", "func | \n", "
13 | \n", "CPython-3.11 | \n", "0.856216 | \n", "no_types | \n", "func | \n", "
14 | \n", "CPython-3.11 | \n", "1.202004 | \n", "numpy | \n", "func | \n", "
15 | \n", "CPython-3.11 | \n", "1.630000 | \n", "with_types | \n", "full | \n", "
16 | \n", "CPython-3.11 | \n", "1.166000 | \n", "no_types | \n", "full | \n", "
17 | \n", "CPython-3.11 | \n", "1.675000 | \n", "numpy | \n", "full | \n", "
18 | \n", "piodide | \n", "1.785000 | \n", "with_types | \n", "func | \n", "
19 | \n", "piodide | \n", "1.681000 | \n", "no_types | \n", "func | \n", "
20 | \n", "piodide | \n", "2.833000 | \n", "numpy | \n", "func | \n", "
21 | \n", "Xeus | \n", "1.155519 | \n", "with_types | \n", "func | \n", "
22 | \n", "Xeus | \n", "1.038669 | \n", "no_types | \n", "func | \n", "
23 | \n", "Xeus | \n", "1.272793 | \n", "numpy | \n", "func | \n", "