-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Excessive reparsing of ambr
files in tests with large snapshots
#837
Comments
ambr
files in tests with large snapshots
I saw a huge increase in performance after splitting my tests in separate files,but it still seems to take a long time for |
As also mentioned in #119, with this extension I reduced the time my tests took from around 200 seconds to around 5.
|
Got things working perfectly with the following snipped: class SingleFileAmberSnapshotExtension(SingleFileSnapshotExtension):
_file_extension = 'ambr'
_write_mode = WriteMode.TEXT
def serialize(self, data, **kwargs):
return AmberDataSerializer.serialize(data, **kwargs) This means I am not going to invest any more time in this ticket. If no objections, this ticket can be closed. |
Let's keep the issue open. We shouldn't be parsing the snapshot file more than once. There's a cache. It must be getting invalidated. Not sure when I'll have time to dig into this but will loop back to this when I have a chance. |
That is interesting.. As the performance difference is about a factor of a hundred. |
Describe the bug
We are encountering a problem in our testing process where we handle very large DOCX/XML files. Our test setup involves using the syrupy library to create snapshots. Here's a snippet of our test code:
While generating large snapshot files is not a problem in itself, we are facing an issue where the
ambr
file is completely reparsed for each test run, even though we only need a snapshot for the specific fixture being tested.To reproduce
Run a test that uses large fixtures, which results in the creation of large snapshot files.
Expected behavior
We expect that testing a large fixture would slow down only that specific test, rather than affecting the performance of all tests that use the same snapshot file. A potential solution might be to have a setting that allows splitting snapshot files with different names into separate files.
Environment (please complete the following information):
Additional context
Our repository is available at: https://gitlab.com/toegang-voor-iedereen/conversion/preprocessing/docx-preprocessor
The text was updated successfully, but these errors were encountered: