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

Don't go through all git objects? #77

Closed
nielsk opened this issue Dec 21, 2019 · 7 comments
Closed

Don't go through all git objects? #77

nielsk opened this issue Dec 21, 2019 · 7 comments

Comments

@nielsk
Copy link

nielsk commented Dec 21, 2019

I tried to start ripasso after a fresh install but always interrupted it because it just ate up my cpu (1 core at 100%) and nothing happened. Then I started it with strace and see tons of calls like this:

access("/home/nik/.password-store/.git/objects/8f/469a1af346305744b801f7d581b82c8f4038cb", F_OK) = 0
stat("/home/nik/.password-store/.git/objects/8f/469a1af346305744b801f7d581b82c8f4038cb", {st_mode=S_IFREG|0400, st_size=6602, ...}) = 0
openat(AT_FDCWD, "/home/nik/.password-store/.git/objects/8f/469a1af346305744b801f7d581b82c8f4038cb", O_RDONLY|O_CLOEXEC) = 5
read(5, "x\1u\232y@Lm\364\307CE\251\320\236\264o\304\244R\242\364\246\262\245\310\222\302\233\345\316\314"..., 6602) = 6602
close(5)                                = 0
stat("/home/nik/.password-store/.git/config", {st_mode=S_IFREG|0664, st_size=302, ...}) = 0
stat("/home/nik/.gitconfig", {st_mode=S_IFREG|0644, st_size=315, ...}) = 0
access("/home/nik/.password-store/.git/objects/8f/469a1af346305744b801f7d581b82c8f4038cb", F_OK) = 0
stat("/home/nik/.password-store/.git/objects/8f/469a1af346305744b801f7d581b82c8f4038cb", {st_mode=S_IFREG|0400, st_size=6602, ...}) = 0
openat(AT_FDCWD, "/home/nik/.password-store/.git/objects/8f/469a1af346305744b801f7d581b82c8f4038cb", O_RDONLY|O_CLOEXEC) = 5
read(5, "x\1u\232y@Lm\364\307CE\251\320\236\264o\304\244R\242\364\246\262\245\310\222\302\233\345\316\314"..., 6602) = 6602
close(5)                                = 0

Apparently ripasso goes through all the files in .git for whatever reason at least on the first start. Since I am using pass for a couple of years and with several hundreds passwords I expect it to be huge…

@alexanderkjall
Copy link
Collaborator

Hi, may i ask how you installed ripasso and what version you are running? Is might be a duplicate of this bug: #57

@nielsk
Copy link
Author

nielsk commented Dec 21, 2019 via email

@nielsk
Copy link
Author

nielsk commented Dec 21, 2019

I installed ripasso-git from the AUR. pacman -Qi ripasso-git:

Name            : ripasso-git
Version         : 226-1
Description     : A password manager that uses the file format of the standard unix password manager 'pass', implemented in rust.
Architecture    : x86_64
URL             : https://github.com/cortex/ripasso/

@alexanderkjall
Copy link
Collaborator

Thanks, then it's not a duplicate. I need to write some performance tests and do some benchmarking in order to have a framework around doing performance improvements. Thanks for the report.

@alexanderkjall
Copy link
Collaborator

I reproduced this, and I think there is two ways to improve this. The first is to improve the handling of populating the list of passwords, right now the logic looks like this:

Get a list of password files, for each fil: parse the git repository to obtain metadata.

If we instead just parsed the git repository once, and obtained information about all files while doing so, then the startup time would scale sort of linear instead of quadratically.

Another avenue for improvement would be to only calculate the meta data when displayed on screen, but that requires an improvement in the cursive library, I have opened a feature request with them here: gyscos/cursive#414

@alexanderkjall
Copy link
Collaborator

Another factor is that the git blame code in libgit2 isn't as fast as git's own code: libgit2/libgit2#3027

alexanderkjall added a commit that referenced this issue Dec 27, 2019
…password list.

In order to have a baseline when fixing the performance problems reported in #77
@alexanderkjall
Copy link
Collaborator

fixed in 4e3b377

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

No branches or pull requests

2 participants