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

feat(profiler): support performance profiling via pprof #768

Merged
merged 5 commits into from
Jul 29, 2024

Conversation

aminya
Copy link
Contributor

@aminya aminya commented Jul 25, 2024

Description

This adds support for performance profiling, allowing for finding bottlenecks and performance optimizations.

It can be enabled via profiler feature and the bench build profile.

cargo build --profile=bench --features=profiler

Motivation and Context

This allows for debugging performance issues such as #767

How Has This Been Tested?

I tested on the repo mentioned in #767

Screenshots / Logs (if applicable)

This screenshot shows that Git Cliff doesn't have any caching, and it goes over the whole history every time no matter what in the subsequent calls.

git-cliff 3758528088515003613 flamegraph

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have formatted the code with rustfmt.
  • I checked the lints with clippy.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@aminya aminya requested a review from orhun as a code owner July 25, 2024 00:56
@codecov-commenter
Copy link

codecov-commenter commented Jul 25, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.

Project coverage is 36.34%. Comparing base (c791418) to head (7c52bb3).
Report is 1 commits behind head on main.

Files Patch % Lines
git-cliff/src/profiler.rs 0.00% 16 Missing ⚠️
git-cliff/src/main.rs 0.00% 7 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #768      +/-   ##
==========================================
- Coverage   36.89%   36.34%   -0.55%     
==========================================
  Files          19       20       +1     
  Lines        1502     1522      +20     
==========================================
- Hits          554      553       -1     
- Misses        948      969      +21     
Flag Coverage Δ
unit-tests 36.34% <0.00%> (-0.55%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

This adds support for performance profiling that allows for finding the bottlenecks and performance optimizations.

It can be enabled via `profiler` feature and the `bench` build profile.

```shell
cargo build --profile=bench --features=profiler
```
Copy link
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loved this PR, thanks a lot! <3

I cleaned up the implementation in 88f93dd, can you take a look and let me know how it looks?

Also, I'm thinking of adding documentation for how to run the profiler. I'm guessing it will be just running cargo run with the profiler features, right?

@orhun orhun changed the title feat: support performance profiling via pprof feat(profiler): support performance profiling via pprof Jul 28, 2024
@orhun
Copy link
Owner

orhun commented Jul 28, 2024

Also added a CI step so the profiler reports are downloadable for each run. e.g. https://github.com/orhun/git-cliff/actions/runs/10131242627/artifacts/1748030753

@aminya
Copy link
Contributor Author

aminya commented Jul 28, 2024

Loved this PR, thanks a lot! <3

You're welcome!

The changes look good to me. The CI step would help catching performance regressions in future.

As for the documentation, I suggest the following:

Performance Profiling

Git-cliff can be built with performance profiling instrumentation, which helps with finding bottlenecks. The profiler can be enabled via the profiler feature and the bench build profile.

cargo build --profile=bench --features=profiler

@orhun
Copy link
Owner

orhun commented Jul 29, 2024

Awesome, thanks!

@orhun orhun merged commit 35dc1e4 into orhun:main Jul 29, 2024
55 checks passed
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.

3 participants