Skip to content

Commit

Permalink
fix: lru_cache on snapshot reads (#629)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahnu authored and Noah Negin-Ulster committed Nov 3, 2022
1 parent 482a7fe commit 53d49df
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/syrupy/extensions/amber/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ def _file_extension(self) -> str:
def _read_snapshot_fossil(self, snapshot_location: str) -> "SnapshotFossil":
return DataSerializer.read_file(snapshot_location)

@staticmethod
@lru_cache()
def __cacheable_read_snapshot(
self, snapshot_location: str, cache_key: str
snapshot_location: str, cache_key: str
) -> "SnapshotFossil":
return DataSerializer.read_file(snapshot_location)

Expand Down

2 comments on commit 53d49df

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 53d49df Previous: 4819026 Ratio
benchmarks/test_1000x.py::test_1000x_reads 0.5521960271378814 iter/sec (stddev: 0.06295328626782529) 0.7731687150709737 iter/sec (stddev: 0.06315633775745262) 1.40
benchmarks/test_1000x.py::test_1000x_writes 0.21099597597897682 iter/sec (stddev: 0.09198206257932137) 0.7412417590036489 iter/sec (stddev: 0.1658742045504701) 3.51
benchmarks/test_standard.py::test_standard 0.5173357443292562 iter/sec (stddev: 0.07871597769789085) 0.6790983820866824 iter/sec (stddev: 0.15597016006618394) 1.31

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 53d49df Previous: 4819026 Ratio
benchmarks/test_1000x.py::test_1000x_writes 0.21099597597897682 iter/sec (stddev: 0.09198206257932137) 0.7412417590036489 iter/sec (stddev: 0.1658742045504701) 3.51

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.