Created
July 15, 2023 19:34
-
-
Save paddymul/15cf85cefddbf8460a9fc8b7601993d7 to your computer and use it in GitHub Desktop.
Memory Usage of bucakroo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "2dc29cdc-d782-41db-993e-7a7c57376c26", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"0.27\n" | |
] | |
} | |
], | |
"source": [ | |
"import os, psutil\n", | |
"def print_mem_usage():\n", | |
" process = psutil.Process()\n", | |
" GB = 1_073_741_824\n", | |
" print(\"{:0.2f}\".format(\n", | |
" process.memory_info().rss/ GB)) # in giga bytes \n", | |
"print_mem_usage()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"id": "5920ade0-8a29-4044-98e2-cb6c3c0e6b3c", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"0.50\n" | |
] | |
} | |
], | |
"source": [ | |
"import pandas as pd\n", | |
"print_mem_usage()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "0bac52fd-2edb-4584-b927-f297243a7948", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"0.50\n" | |
] | |
} | |
], | |
"source": [ | |
"import buckaroo\n", | |
"print_mem_usage()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"id": "579b0a5e-853d-4d0f-8e20-a6c4905a93e4", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"4.29\n" | |
] | |
} | |
], | |
"source": [ | |
"df = pd.read_parquet('1993-flights.gzip.parquet')\n", | |
"print_mem_usage()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"id": "4849f376-018b-4e3c-b4ec-dc5cd61fc22d", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"6.60\n" | |
] | |
} | |
], | |
"source": [ | |
"buckaroo.BuckarooWidget(df)\n", | |
"print_mem_usage()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"id": "b7c54bf4-de69-40cf-a793-f426eae5408e", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"6.74\n" | |
] | |
} | |
], | |
"source": [ | |
"buckaroo.BuckarooWidget(df)\n", | |
"print_mem_usage()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"id": "f04a0004-129f-4aaa-a0aa-38ff5c381775", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"4.63 s ± 398 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" | |
] | |
} | |
], | |
"source": [ | |
"%timeit buckaroo.BuckarooWidget(df)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "8707c9eb-7ecd-4fb2-8521-0140a00dbdfb", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.11.3" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment