-
-
Save mjpieters/a4d01024f50d56210dceefc1acdbd487 to your computer and use it in GitHub Desktop.
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
>>> 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