Skip to content

Instantly share code, notes, and snippets.

View aeros's full-sized avatar

Kyle Stanley aeros

  • Python Software Foundation
  • FL, US
  • X @aeros_py
View GitHub Profile
@aeros
aeros / get_size.py
Last active November 14, 2019 08:37
Get the size of an object.
import sys
import types
import gc
ignored_types = (
type,
types.FunctionType,
types.LambdaType,
types.MethodType,
types.BuiltinFunctionType,
@aeros
aeros / asyncio_get_loop_bench.py
Last active October 17, 2019 07:44
Benchmark to compare the performance of asyncio.get_running_loop() and asyncio.get_event_loop() within a coroutine.
import asyncio
import time
total_tests = 10_000_000
async def test_get_running_loop():
return asyncio.get_running_loop()
async def test_get_event_loop():
return asyncio.get_event_loop()