-
-
Notifications
You must be signed in to change notification settings - Fork 204
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
Extreme memory usage when running it on the linux kernel repo with cliff.toml from this project #1
Comments
Thanks for reporting this. It turns out this high memory usage happens at the following line: git-cliff/git-cliff/src/lib.rs Line 100 in 2b8b4d3
Which calls this function: git-cliff/git-cliff-core/src/repo.rs Lines 39 to 51 in 2b8b4d3
In conclusion I'd say this is most likely caused by git2. So this issue basically boils down to: use git2::{Commit, Repository, Sort};
use std::env;
fn main() {
let repo_path = env::var("LINUX_KERNEL_REPO").expect("repo path is not specified");
let repo = Repository::open(repo_path).expect("cannot open repo");
let mut revwalk = repo.revwalk().unwrap();
revwalk.set_sorting(Sort::TIME | Sort::TOPOLOGICAL).unwrap();
revwalk.push_head().unwrap();
let commits: Vec<Commit> = revwalk
.filter_map(|id| id.ok())
.filter_map(|id| repo.find_commit(id).ok())
.collect();
println!("{}", commits.len());
} To reproduce: cargo new --bin repro && cd repro/
# add `git2 = "0.13.21"` to [dependencies] in Cargo.toml
# save the code above as src/main.rs
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux
LINUX_KERNEL_REPO="$(pwd)/linux" cargo run I think you should also report this to |
Thanks for investigating this. It's interesting that running the above I see this:
Maybe the real memory explosion happens elsewhere when processing more than a million commits. |
Ah, I just get a similar result. But it took longer due to my low specs I guess.
I'm re-investigating this issue. 👍🏼 |
Sadly libgit2 is missing some significant optimizations that the |
I pushed f859747 and it should affect the performance dramatically. In fact, I was able to generate a changelog from the linux kernel repository this time: $ cargo run --release -- -r ~/gh/linux/ -c cliff.toml -o LINUX_CHANGELOG results in: # Changelog
All notable changes to this project will be documented in this file.
## [unreleased]
### ALSA
- Pcm: Fix mmap breakage without explicit buffer setup
- Hda/realtek: fix mute/micmute LEDs for HP ProBook 650 G8 Notebook PC
### MAINTAINERS
- Update Vineet's email address
- Fix Microchip CAN BUS Analyzer Tool entry typo
- Switch to my OMP email for Renesas Ethernet drivers
### Security
- Igmp: fix data-race in igmp_ifc_timer_expire()
[...] Can you try it out to see if it's any better? |
Fantastic, the fix is probably one of the most effective one-line changes I have ever seen! Here it the tail of my cliff run on the linux kernel:
I think that's quite alright :). In case you are interested in being even faster, here is another tool to estimate the hours it would take to implement the commits of a repository.
|
Describe the bug
When running it on https://github.com/torvalds/linux with the cliff.toml from this repository, the
git-cliff
process will take a lot of time and consume more and more memory. I had to stop it at 12GB.To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/torvalds/linux cp cliff.toml ./linux/ cd linux git cliff
Expected behavior
A log is produced in reasonable time.
System (please complete the following information):
Ran f1b495d on MacOS with 8GB of RAM and M1
The text was updated successfully, but these errors were encountered: