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 52a2af9 commit 6d17701
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

1 comment on commit 6d17701

@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: 6d17701 Previous: aded3ee Ratio
benchmarks/test_1000x.py::test_1000x_reads 0.663979575144748 iter/sec (stddev: 0.08603317931454343) 0.5142446202575975 iter/sec (stddev: 0.06374579386963966) 0.77
benchmarks/test_1000x.py::test_1000x_writes 0.2517063889062297 iter/sec (stddev: 0.08333995059854736) 0.48855129949798093 iter/sec (stddev: 0.22598445680515478) 1.94
benchmarks/test_standard.py::test_standard 0.613192849203317 iter/sec (stddev: 0.11559395793548362) 0.4615636634825626 iter/sec (stddev: 0.2136260609033771) 0.75

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

Please sign in to comment.