Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use test cache for test result images too.#15932

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 1 commit intomatplotlib:masterfromanntzer:testcache
Sep 25, 2020

Conversation

anntzer
Copy link
Contributor

@anntzeranntzer commentedDec 13, 2019
edited
Loading

For image comparison tests in svg/pdf/ps formats, the result images are
converted to png for comparison. Previously the conversion results were
cached for the baseline images, but not for the test-generated images
(because of non-deterministic svg/pdf/etc. results, due to
hash-salting, dict ordering, etc.).

Now that the test-generated images are generally deterministic, we can
enable the cache for baseline images as well. This speeds up
pytest -k '[svg]' by ~30% (81s initially -> 55s on a seeded cache) and
pytest -k '[pdf]' by ~10% (62s -> 55s) (there are too few (e)ps image
comparison tests to see an effect). Also add logging regarding the
cache which may help troubleshooting determinacy problems.

This is a much simpler version of PR#7764, which added more sophisticated
reporting of cache hits and misses, as well as cache invalidation (I
think the cache can reasonably be cleaned manually, at least for now).

A simple cache eviction mechanism prevents the cache from growing
without bounds, limiting it to 2x the size of the baseline_images
directory.

This is a much simpler version of PR7764, which added more sophisticated
reporting of cache hits and misses and cache eviction.

Supersedes (mostly)#7764 (@jkseppan).

(Note that the gain in speed is less than reported than in#7764 (comment), because I have also optimized the svg and gs converters in the meantime by running a single process and interacting with it over stdin/stdout, rather that launching a new instance of inkscape/ghostscript for each image.)

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@tacaswell
Copy link
Member

If we have a few tests that are not deterministic, will this cause the cache to increase without bound?

I think that we cache these folders on at least travis so we would want to make sure we don't start spending more time moving around invalid images than we save by not computing them.

@anntzer
Copy link
ContributorAuthor

anntzer commentedDec 13, 2019
edited
Loading

Fair enough, added a simple (automatic) cache eviction mechanism.

@jklymakjklymak marked this pull request as draftSeptember 24, 2020 15:57
@jklymak
Copy link
Member

I don't fully follow this, but itseems useful. But needs a rebase, and probably a review from@tacaswell or@QuLogic

For image comparison tests in svg/pdf/ps formats, the result images areconverted to png for comparison.  Previously the conversion results werecached for the baseline images, but not for the test-generated images(because of non-deterministic svg/pdf/etc. results, due tohash-salting, dict ordering, etc.).Now that the test-generated images are generally deterministic, we canenable the cache for baseline images as well.  This speeds up`pytest -k '[svg]'` by ~30% (81s initially -> 55s on a seeded cache) and`pytest -k '[pdf]'` by ~10% (62s -> 55s) (there are too few (e)ps imagecomparison tests to see an effect).  Also add logging regarding thecache which may help troubleshooting determinacy problems.A simple cache eviction mechanism prevents the cache from growingwithout bounds, limiting it to 2x the size of the baseline_imagesdirectory.This is a much simpler version of PR7764, which added more sophisticatedreporting of cache hits and misses and cache eviction.
@anntzer
Copy link
ContributorAuthor

rebased

@anntzeranntzer marked this pull request as ready for reviewSeptember 24, 2020 18:16
@tacaswelltacaswell merged commit64950dd intomatplotlib:masterSep 25, 2020
@tacaswelltacaswell added this to thev3.4.0 milestoneSep 25, 2020
@anntzeranntzer deleted the testcache branchSeptember 25, 2020 07:22
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.4.0
Development

Successfully merging this pull request may close these issues.

4 participants
@anntzer@tacaswell@jklymak@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp