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

areas for performance improvements #194

Open
rbuckland opened this issue Feb 24, 2024 · 3 comments
Open

areas for performance improvements #194

rbuckland opened this issue Feb 24, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@rbuckland
Copy link

Is your feature request related to a problem? Please describe.

We notice that as our monorepo gets bigger, the time to generate a version, for some of our packages, is getting longer, or, at times is longer.

Today, generating a bump version took approx 40s.
I am unsure if this is related to the distance between the "last" tag, or monorepo and needing to filter out paths, or other.

Describe the solution you'd like
assist with investigation and provide feedback on ways to improve the performance.

Additional context

Our monorepo "produces" 7+ packages. Each package is prefixed on its tag (simple directory is tag)

tags/lib/mylib/v7.6.1 --> for lib/mylib
tags/apps/app123/v2.8.0 --> for apps/app123

Running convco looks like

❯ time convco version --prefix lib/mylib/v --paths lib/mylib --bump  
7.5.0
convco version --prefix lib/mylib/v --paths lib/mylib --bump  42.50s user 0.65s system 99% cpu 43.153 total

which takes approx 42s

Attached is analysis using flamegraph, (https://github.com/flamegraph-rs/flamegraph)
from the same run above.

  • The last version tag was in december 15 2023.
  • 575 commits in total between that tag and "today",
  • of which 318 were directly related to this library (lib/mylib)
> git log --oneline lib/mylib/v7.4.0..HEAD | wc -l
575
> git log --oneline lib/mylib/v7.4.0..HEAD -- lib/mylib | wc -l
318

convco_perf

@rbuckland rbuckland added the enhancement New feature or request label Feb 24, 2024
@hdevalke
Copy link
Collaborator

https://github.com/convco/convco/blob/master/src/git.rs#L167 could be faster if the for each stops at the first match.

What is the expected time? For example how long does a git log previous..HEAD -- path/ takes?

hdevalke added a commit that referenced this issue Feb 25, 2024
Delegates the path selection to diff options.
Other improvement to do for `convco version` is to take 1 diff between the previous version and the head instead of 1 diff per commit.

Refs: #194
@hdevalke
Copy link
Collaborator

I was wrong, the code already stopped the for_each at the first path found.
I made a fix that will probably improve performance, but i am not sure about it.

Would you be able to test #195?
Or do you know a similar public repo I could test this?

I thought there is a second improvement possible by only doing 1 diff for version, but this will not be possible as we need to make 1 diff per commit to know if the path is included.

We know make a diff to before parsing the commit to a conventional commit. It might be useful to parse the commit first and filter on commits that are breaking or increment the version. This would skip useless diff calculations.

@hdevalke
Copy link
Collaborator

hdevalke commented Mar 6, 2024

I tried to do some benchmarks, but i could not find a difference.

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

No branches or pull requests

2 participants