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

Significant performance degradation in super_diff 0.8 #139

Open
hedgesky opened this issue Jun 23, 2021 · 1 comment
Open

Significant performance degradation in super_diff 0.8 #139

hedgesky opened this issue Jun 23, 2021 · 1 comment
Labels

Comments

@hedgesky
Copy link

Hi @mcmire,
thank you a lot for an amazing gem! It removed a lot of pain from working with some of the specs we have in the codebase.

I noticed that after upgrading super_diff to 0.8 our test suite slowed down by 4x (from ≈30s to 2m). Downgrading to 0.7 resolves the issue.

I ran some profiling and tried to analyse execution path, and it looks like the issue appeared after merging #91. Profiling showed that majority of the time is spent in SuperDiff::ObjectInspection::InspectionTree#render_to_string.

I tried to understand what's going on and how it would be possible to avoid that, but wasn't able to, unfortunately.

Attaching the profiling screenshot:
Screenshot 2021-06-23 at 11 57 50

@mcmire
Copy link
Collaborator

mcmire commented Dec 29, 2022

Hi @hedgesky,

Sorry for taking so long to reply to this issue. It initially surprised me to hear that the gem decreased performance because it really should only kick in when a test fails, but after looking at your screenshot, I'm realizing that the gem monkeypatches the description for each built-in RSpec matcher, so every time RSpec accesses a description it'll go through some logic here in the gem. I would imagine that some simple tricks can be applied to the inspection logic to fix the performance issue. Anyway, thank you for reporting this. I admit that I've been lax in tending to this gem lately due to life, but I will try to make an effort to take a closer look at this soon.

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

No branches or pull requests

2 participants