{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Comparison of Charting Libraries Performance" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2024-04-26T11:56:24.230758Z", "iopub.status.busy": "2024-04-26T11:56:24.230758Z", "iopub.status.idle": "2024-04-26T11:56:25.157640Z", "shell.execute_reply": "2024-04-26T11:56:25.157640Z" } }, "outputs": [], "source": [ "import pandas as pd\n", "\n", "from lets_plot import *\n", "from lets_plot.mapping import as_discrete" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2024-04-26T11:56:25.157640Z", "iopub.status.busy": "2024-04-26T11:56:25.157640Z", "iopub.status.idle": "2024-04-26T11:56:25.173766Z", "shell.execute_reply": "2024-04-26T11:56:25.173766Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Preliminaries" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2024-04-26T11:56:25.189498Z", "iopub.status.busy": "2024-04-26T11:56:25.189498Z", "iopub.status.idle": "2024-04-26T11:56:25.220806Z", "shell.execute_reply": "2024-04-26T11:56:25.220806Z" }, "scrolled": false }, "outputs": [], "source": [ "def get_json_data(file_path):\n", " from requests import get\n", "\n", " r = get(file_path, stream=True)\n", " if r.status_code == 200:\n", " return r.json()\n", " else:\n", " return {}\n", "\n", "def get_data(file_path):\n", " colors = {\n", " 'LightningChart': '#e41a1c',\n", " 'Plotly.js': '#4daf4a',\n", " 'Canvas.js': '#ff7f00',\n", " 'eCharts': '#ffff33',\n", " 'Lets-Plot groups': '#377eb8',\n", " 'Lets-Plot layers': '#984ea3',\n", " }\n", " data = {\n", " 'test': [],\n", " 'lib': [],\n", " 'channels_count': [],\n", " 'channel_data_points_per_second': [],\n", " 'time_domain_interval': [],\n", " 'loadup_speed_ms': [],\n", " 'fps_avg': [],\n", " 'fps_median': [],\n", " 'frame_time_avg': [],\n", " 'frame_time_median': [],\n", " 'color': [],\n", " }\n", " for test, test_data in get_json_data(file_path).items():\n", " for lib, test_lib_data in test_data.items():\n", " data['test'].append(test)\n", " data['lib'].append(lib)\n", " data['channels_count'].append(test_lib_data['config']['channelsCount'])\n", " data['channel_data_points_per_second'].append(test_lib_data['config']['channelDataPointsPerSecond'])\n", " data['time_domain_interval'].append(test_lib_data['config']['timeDomainInterval'])\n", " data['loadup_speed_ms'].append(test_lib_data['loadupSpeedMs'])\n", " data['fps_avg'].append(test_lib_data['fps']['avg'])\n", " data['fps_median'].append(test_lib_data['fps']['median'])\n", " data['frame_time_avg'].append(test_lib_data['frameTime']['avg'])\n", " data['frame_time_median'].append(test_lib_data['frameTime']['median'])\n", " data['color'].append(colors[lib])\n", " return pd.DataFrame.from_dict(data)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2024-04-26T11:56:25.220806Z", "iopub.status.busy": "2024-04-26T11:56:25.220806Z", "iopub.status.idle": "2024-04-26T11:56:25.755221Z", "shell.execute_reply": "2024-04-26T11:56:25.755221Z" } }, "outputs": [ { "data": { "text/html": [ "\n", " | test | \n", "lib | \n", "channels_count | \n", "channel_data_points_per_second | \n", "time_domain_interval | \n", "loadup_speed_ms | \n", "fps_avg | \n", "fps_median | \n", "frame_time_avg | \n", "frame_time_median | \n", "color | \n", "load | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "A | \n", "LightningChart | \n", "1 | \n", "1000 | \n", "1000 | \n", "101.7 | \n", "58.412474 | \n", "58.259538 | \n", "17.258501 | \n", "16.90 | \n", "#e41a1c | \n", "1000 | \n", "
1 | \n", "A | \n", "Plotly.js | \n", "1 | \n", "1000 | \n", "1000 | \n", "92.7 | \n", "40.252554 | \n", "40.922497 | \n", "30.025803 | \n", "24.25 | \n", "#4daf4a | \n", "1000 | \n", "
2 | \n", "A | \n", "Canvas.js | \n", "1 | \n", "1000 | \n", "1000 | \n", "101.5 | \n", "23.045579 | \n", "23.116954 | \n", "43.772100 | \n", "43.10 | \n", "#ff7f00 | \n", "1000 | \n", "
3 | \n", "A | \n", "eCharts | \n", "1 | \n", "1000 | \n", "1000 | \n", "48.0 | \n", "59.155815 | \n", "59.053692 | \n", "16.941370 | \n", "17.00 | \n", "#ffff33 | \n", "1000 | \n", "
4 | \n", "A | \n", "Lets-Plot groups | \n", "1 | \n", "1000 | \n", "1000 | \n", "68.1 | \n", "49.928318 | \n", "51.291719 | \n", "19.021224 | \n", "18.00 | \n", "#377eb8 | \n", "1000 | \n", "
5 | \n", "A | \n", "Lets-Plot layers | \n", "1 | \n", "1000 | \n", "1000 | \n", "104.9 | \n", "57.002319 | \n", "58.007307 | \n", "17.057078 | \n", "17.00 | \n", "#984ea3 | \n", "1000 | \n", "