summaryrefslogtreecommitdiff
path: root/src/buildstream/storage
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2019-07-26 14:47:08 +0100
committerBenjamin Schubert <contact@benschubert.me>2019-07-29 10:42:02 +0100
commit90da23867767905c39bf8199c2b8a4d6e13a5c95 (patch)
tree44f658016a1176a7985681421cc76fbcc671a323 /src/buildstream/storage
parent7736e44adb29688c13da1f4c5bddf03bd878a0f3 (diff)
downloadbuildstream-90da23867767905c39bf8199c2b8a4d6e13a5c95.tar.gz
types: Add a 'FastEnum' implementation and replace Enum by it
'Enum' has a big performance impact on the running code. Replacing it with a safe subset of functionality removes lots of this overhead without removing the benefits of using enums (safe comparisions, uniqueness)
Diffstat (limited to 'src/buildstream/storage')
-rw-r--r--src/buildstream/storage/directory.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/buildstream/storage/directory.py b/src/buildstream/storage/directory.py
index d32ac0063..5039e0af9 100644
--- a/src/buildstream/storage/directory.py
+++ b/src/buildstream/storage/directory.py
@@ -31,9 +31,9 @@ See also: :ref:`sandboxing`.
"""
-from enum import Enum
from .._exceptions import BstError, ErrorDomain
+from ..types import FastEnum
from ..utils import BST_ARBITRARY_TIMESTAMP
@@ -196,7 +196,7 @@ class Directory():
#
# Type of file or directory entry.
#
-class _FileType(Enum):
+class _FileType(FastEnum):
# Directory
DIRECTORY = 1