Title: git_status_list is slower than `git status` · Issue #4230 · libgit2/libgit2 · GitHub
Open Graph Title: git_status_list is slower than `git status` · Issue #4230 · libgit2/libgit2
X Title: git_status_list is slower than `git status` · Issue #4230 · libgit2/libgit2
Description: Reproduction steps Build provided libgit2status tool (I'll post it source in the next comment to keep initial report easier to read) and run it in the root of large enough repo. Compare it speed with git status. % go version go version g...
Open Graph Description: Reproduction steps Build provided libgit2status tool (I'll post it source in the next comment to keep initial report easier to read) and run it in the root of large enough repo. Compare it speed wi...
X Description: Reproduction steps Build provided libgit2status tool (I'll post it source in the next comment to keep initial report easier to read) and run it in the root of large enough repo. Compare it spee...
Opengraph URL: https://github.com/libgit2/libgit2/issues/4230
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"git_status_list is slower than `git status`","articleBody":"### Reproduction steps\r\n\r\nBuild provided `libgit2status` tool (I'll post it source in the next comment to keep initial report easier to read) and run it in the root of large enough repo. Compare it speed with `git status`.\r\n\r\n```\r\n% go version\r\ngo version go1.8.1 linux/amd64\r\n% git --version\r\ngit version 2.10.2\r\n% git clone https://github.com/gentoo/gentoo.git\r\n% cd gentoo\r\n% find -type f | wc -l\r\n99540\r\n% find -type d | wc -l\r\n27306\r\n% git config core.untrackedCache false\r\n% time git status --short\r\n\r\n0.257 real 0.128 user 0.206 sys 32MB RAM\r\n% git config core.untrackedCache true\r\n% time git status --short\r\n\r\n0.097 real 0.067 user 0.110 sys 38MB RAM\r\n% time libgit2status\r\n{AddedFiles:0 ModifiedFiles:0 DeletedFiles:0 RenamedFiles:0 UnmergedFiles:0 HasUntrackedFiles:false}\r\n\r\n0.626 real 0.340 user 0.282 sys 154MB RAM\r\n% touch profiles/base/testfile.added\r\n% touch profiles/base/testfile.new\r\n% git add profiles/base/testfile.added\r\n% time git status --short\r\nA profiles/base/testfile.added\r\n?? profiles/base/testfile.new\r\n\r\n0.115 real 0.082 user 0.108 sys 38MB RAM\r\n% git config core.untrackedCache false\r\n% time git status --short\r\nA profiles/base/testfile.added\r\n?? profiles/base/testfile.new\r\n\r\n0.255 real 0.134 user 0.193 sys 32MB RAM\r\n% time libgit2status\r\n{AddedFiles:1 ModifiedFiles:0 DeletedFiles:0 RenamedFiles:0 UnmergedFiles:0 HasUntrackedFiles:true}\r\n\r\n0.611 real 0.358 user 0.250 sys 154MB RAM\r\n```\r\n\r\n### Expected behavior\r\n\r\nWell… in my dream git2go should works at least as fast as `git status`… actually faster if we just needs to know is workdir is dirty or is it has any untracked files - without needs to know full list of all added/modified/untracked/etc. files output by `git status`.\r\n\r\n### Actual behavior\r\n\r\nIt's nearly 2.5 times slower than `git status` on my system (HDD, i7-2600K overcloked @ 4.5GHz) without untrackedCache and 5-6 times slower with untrackedCache.\r\n\r\nWhile strace-ing `git status` I've noticed it calls `lstat` from 2 or 3 threads - can this be the reason?\r\n\r\nFor all `time`d runs above I take average result from several runs and my system has enough RAM to keep dircache for the full repo, so there was no (noticeable, at least) disk accesses, and thus HDD/SSD shouldn't make any difference.\r\n\r\n### Version of libgit2 (release number or SHA1)\r\n\r\ndf4dfaa\r\n\r\nThis version is vendored by git2go. I've tried to update to current master but get this error:\r\n```\r\n./submodule.go:339: ptr.clone_checkout_strategy undefined (type *C.struct_git_submodule_update_options has no field or method clone_checkout_strategy)\r\n```\r\nIf something was just renamed then it probably can be easily fixed to allow testing with latest master.\r\n\r\n### Operating system(s) tested\r\n\r\nHardened Gentoo Linux, amd64.","author":{"url":"https://github.com/powerman","@type":"Person","name":"powerman"},"datePublished":"2017-05-02T13:02:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":32},"url":"https://github.com/4230/libgit2/issues/4230"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:54123ef0-848c-8f8d-1c55-e5f65947c800 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 93DC:B1D4C:61DE411:80387CD:6A5DBB6B |
| html-safe-nonce | ecf4eaab7f0a7a1416dfc8972fe05bc640c133102172a3531473919a1840bf0a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5M0RDOkIxRDRDOjYxREU0MTE6ODAzODdDRDo2QTVEQkI2QiIsInZpc2l0b3JfaWQiOiI0OTI5NzQ2OTU0Mjc5MDQxODk5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 95cd10969d18d82d0bb8a48ea730f091879877d923dc9d3428b26259f5253b46 |
| hovercard-subject-tag | issue:225688146 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/libgit2/libgit2/4230/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5d918de24c54ada6a04c0d37001bc862e9b542bb61a71ca84d4e298ec1fce25d/libgit2/libgit2/issues/4230 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5d918de24c54ada6a04c0d37001bc862e9b542bb61a71ca84d4e298ec1fce25d/libgit2/libgit2/issues/4230 |
| og:image:alt | Reproduction steps Build provided libgit2status tool (I'll post it source in the next comment to keep initial report easier to read) and run it in the root of large enough repo. Compare it speed wi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | powerman |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/libgit2/libgit2 git https://github.com/libgit2/libgit2.git |
| octolytics-dimension-user_id | 394745 |
| octolytics-dimension-user_login | libgit2 |
| octolytics-dimension-repository_id | 901662 |
| octolytics-dimension-repository_nwo | libgit2/libgit2 |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 901662 |
| octolytics-dimension-repository_network_root_nwo | libgit2/libgit2 |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width