-
Notifications
You must be signed in to change notification settings - Fork 110
performance: don't create subshells #193
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
Conversation
|
TDD FTW 🚀 Failing on Will have a look and see what could be the alternative EDIT: no cigar. Pausing efforts |
|
Thanks for looking at this @andreineculau, there's some dark magic in those pipe commands but if it runs much faster it's well worth the change. What kind of performance improvements are you seeing, out of interest? I found the test failures blocking you were because of a latent bug in my older code: the text content checks in your changes were more correct than mine, and highlighted a problem elsewhere. I have pushed a fix for the code that calls the If you can add some comments, and maybe squash the PR down to a cleaner history, I should be able to merge it to |
|
Fantastic! I didn't have time to look into the failures and I assumed we won't have full coverage. But if we do... 🚀 I will get back with some time stats and content the magic |
7405209 to
f18c4a4
Compare
|
and these are the performance metrics in a repo with 25 encrypted files, >40 000 files. PR version, running current version, running AND no, there is no error. It is that slow :) |
Greatly improve performance in a repository with many files for pre-commit safety check, encrypted file listing, and showing raw file. Performance wins are achieved by avoiding creation of subshells in a tight loop when processing Git's `ls-files` and instead using a smart piping alternative approach. Thanks Andrei!
|
Excellent, thanks for perfecting this huge performance improvement @andreineculau. I've merged it to Those performance numbers from before your fix are horrifying 😱 |
* main: (27 commits) Add or update references to me (James Murty) as project maintainer Update long-outdated copyright notices Note performance improvements from #193 in changelog Remove repeated lines in comments Add tests for feature: detect incorrect password on init Improve name of function that counts dirty files, and do all the needed work in the function handle --force when checking for incorrect password performance: don't create subshells Document in changelog improvements by weichunglee in PR #197 fix logic for version checking in pre_commit, fix empty files always failing validate_file Update ongoing dev version to 2.3.2-pre Release 2.3.1 Warn when password is probably incorrect with error message and return code #182 Fix --export-gpg command to properly include cipher in exported .asc file Fail with error when an empty password is provided to the -p or --password options #188 Make --upgrade safer by failing fast if transcrypt config cannot be read #189 Remove hard dependency on `xxd` which can be onerous, fall back to `printf` or `perl` instead #181 Don't set global Git config when running tests Make ongoing dev version 2.3.1-pre Release 2.3.0 ...
…unrecognised names #204 Tweak the file listing to fix two issues found to affect files with problematic names like `"Terrible file""")))(((][][].secret`. This change may undo performance improvements achieved in #193. - Ensure the `git check-attr filter` command does not quote file name characters by using `-z` arg and some extra trickery to keep space and newline delimiter characters for filter metadata and each file name respectively. This fixes a file named `"Terrible file""")))(((][][].secret` being listed as just `Terrible file`. - Adjust checking for `filter` and `crypt` strings to work with changed output from `check-attr` command. - Tweak `eval 'echo $filename'` portion of command to avoid script crash on files with special characters with error message like `eval: line 192: syntax error near unexpected token`
|
Thanks a ton for the fix @andreineculau , you really made my day. While I am running the latest version of transcrypt (2.3.1), it took me a while to figure out that there was a fix available for my performance issue. Would it be possible to release a new version with this fix? |
|
Hi @jeancornic thanks for the feedback. I have been slow to release a new version because the pending changes haven't been widely tested, and in fact an issue with the performance improvement for repos with many files surfaced just yesterday in #204. Could you and @andreineculau try the tweaked version on branch |
I have some repos with many many files.
I haven't checked the git history for a reason on using a for loop and subshell and bash pattern checking instead, but going with piping and grep and sed makes a night and day difference.