This file contains hidden or 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
# ############ __slots__ for improved memory usage ############# | |
# Create by Michael Kennedy (@mkennedy) | |
# | |
# Overview: | |
# Custom types store their data in individualized, dynamic dictionaries | |
# via self.__dict__. Using __slots__ to limit available attribute names | |
# and move the name/key storage outside the instance to a type level | |
# can significantly improve memory usage. See EOF for perf numbers. | |
# |
This file contains hidden or 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
# ############ DICTIONARY vs. LIST LOOKUP PERF ############# | |
# Create by Michael Kennedy (@mkennedy) | |
# | |
# Overview: | |
# If you had a large set of data and you need to "find" a subset | |
# of elements by some value (equality not a computation, such as | |
# between two values), it is dramatically faster. See the output | |
# comments at the very end of this file for numbers. | |
# | |
import collections |
This file contains hidden or 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
import opbeat | |
import opbeat.instrumentation | |
import opbeat.instrumentation.control | |
from pyramid.events import NewRequest | |
from pyramid.events import subscriber | |
from pyramid.httpexceptions import HTTPRedirection, HTTPException | |
opbeat_is_debug_mode = False | |
opbeat.instrumentation.control.instrument() |
NewerOlder