Skip to content

Commit edef9cb

Browse files
authored
shape_core.py -> prelim attempt at caching with functools lru_cache
1 parent 890f1a5 commit edef9cb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/build123d/topology/shape_core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import itertools
5151
import warnings
5252
from abc import ABC, abstractmethod
53+
from functools import lru_cache
5354
from typing import (
5455
cast as tcast,
5556
Any,
@@ -2935,7 +2936,7 @@ def _sew_topods_faces(faces: Iterable[TopoDS_Face]) -> TopoDS_Shape:
29352936
shell_builder.Perform()
29362937
return downcast(shell_builder.SewedShape())
29372938

2938-
2939+
@lru_cache(maxsize=128) # default is 128
29392940
def _topods_entities(shape: TopoDS_Shape, topo_type: Shapes) -> list[TopoDS_Shape]:
29402941
"""Return the TopoDS_Shapes of topo_type from this TopoDS_Shape"""
29412942
out = {} # using dict to prevent duplicates

0 commit comments

Comments
 (0)