Skip to content
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

[with-temp] Delay pprint in do-with-temp #197

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexander-yakushev
Copy link
Contributor

Using pprint to provide context for clojure.core/testing macro can be a bit expensive and ultimately wasteful if the test doesn't fail. I've merged a fix for this in Metabase here metabase/metabase#52830, but I've just come up with a better idea. Since clojure.test ultimately calls str on the values inside clojure.test/*testing-contexts*, we can pass a custom CharSequence object to testing that doesn't compute the result until requested.

Here's the effect it has on one of the slow tests, metabase.api.downloads-exports-test/pivot-with-scale-test: https://flamebin.dev/cQgqtG. -10% allocations and comparative speed improvement in that test.

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.55%. Comparing base (b412026) to head (80d06fc).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #197   +/-   ##
=======================================
  Coverage   83.55%   83.55%           
=======================================
  Files          37       37           
  Lines        2506     2506           
  Branches      212      212           
=======================================
  Hits         2094     2094           
  Misses        200      200           
  Partials      212      212           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant