Skip to content

Commit df5b516

Browse files
authored
perf: memoise DataSerializer.read_file results (#543)
* perf: memoise DataSerializer.read_file results
1 parent 5906c25 commit df5b516

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/syrupy/extensions/amber/serializer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import functools
12
import os
23
from types import GeneratorType
34
from typing import (
@@ -79,6 +80,7 @@ def write_file(cls, snapshot_fossil: "SnapshotFossil") -> None:
7980
f.write(f"\n{cls._marker_divider}\n")
8081

8182
@classmethod
83+
@functools.lru_cache()
8284
def read_file(cls, filepath: str) -> "SnapshotFossil":
8385
"""
8486
Read the raw snapshot data (str) from the snapshot file into a dict

0 commit comments

Comments
 (0)