Skip to content

Instantly share code, notes, and snippets.

@mjpieters
Created November 20, 2018 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjpieters/a4d01024f50d56210dceefc1acdbd487 to your computer and use it in GitHub Desktop.
Save mjpieters/a4d01024f50d56210dceefc1acdbd487 to your computer and use it in GitHub Desktop.
>>> from typing import NamedTuple
>>> class NTEdge(NamedTuple):
... node1: int = 0
... node2: int = 0
... weight: int = 0
...
>>> count, total = Timer(listcomploop, 'from __main__ import NTEdge as Edge, ijw').autorange()
>>> (total / count) * 1000 # milliseconds
453.54825801041443
>>> count, total = Timer(listcomploop, 'from __main__ import SlotsEdge as Edge, ijw').autorange()
>>> (total / count) * 1000 # milliseconds
459.7490729938727
>>> import sys
>>> sys.getsizeof(SlotsEdge())
64
>>> sys.getsizeof(NTEdge())
72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment