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 30, 2022
1 parent 6c3c317 commit 3325b3c
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 3325b3c

@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: 3325b3c Previous: 23cca84 Ratio
benchmarks/test_1000x.py::test_1000x_reads 0.7501524856711987 iter/sec (stddev: 0.04976543897901793) 0.6754078596653935 iter/sec (stddev: 0.06391877117699159) 0.90
benchmarks/test_1000x.py::test_1000x_writes 0.2720546623005211 iter/sec (stddev: 0.07148589269032116) 0.6345993135561808 iter/sec (stddev: 0.23174880874067105) 2.33
benchmarks/test_standard.py::test_standard 0.7097310415863828 iter/sec (stddev: 0.06284237301317733) 0.6315599143065584 iter/sec (stddev: 0.0923523543680502) 0.89

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: 3325b3c Previous: 23cca84 Ratio
benchmarks/test_1000x.py::test_1000x_writes 0.2720546623005211 iter/sec (stddev: 0.07148589269032116) 0.6345993135561808 iter/sec (stddev: 0.23174880874067105) 2.33

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

Please sign in to comment.