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 8, 2022
1 parent e55cd6b commit 3279e90
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 3279e90

@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: 3279e90 Previous: 7338a37 Ratio
benchmarks/test_1000x.py::test_1000x_reads 0.4832337652549864 iter/sec (stddev: 0.09881326058838083) 0.7709457808187364 iter/sec (stddev: 0.048477423261161674) 1.60
benchmarks/test_1000x.py::test_1000x_writes 0.1948321940206005 iter/sec (stddev: 0.10609212438204667) 0.7324448561011113 iter/sec (stddev: 0.1797315355688859) 3.76
benchmarks/test_standard.py::test_standard 0.4595185700405558 iter/sec (stddev: 0.10654864523105473) 0.6751254128832423 iter/sec (stddev: 0.17226093415862248) 1.47

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: 3279e90 Previous: 7338a37 Ratio
benchmarks/test_1000x.py::test_1000x_writes 0.1948321940206005 iter/sec (stddev: 0.10609212438204667) 0.7324448561011113 iter/sec (stddev: 0.1797315355688859) 3.76

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

Please sign in to comment.