Title: git log -15 is slow · Issue #1558 · libgit2/libgit2sharp · GitHub
Open Graph Title: git log -15 is slow · Issue #1558 · libgit2/libgit2sharp
X Title: git log -15 is slow · Issue #1558 · libgit2/libgit2sharp
Description: Environment: libgit2sharp version: 0.24.1 from NuGet .NET version: 4.5 OS: Windows 7, 32 bit. CPU: Intel Core i7 @ 1.8 GHz. storage: local SSD Test case: Clone a large Git repo. (I try with https://github.com/python/cpython ). Run git lo...
Open Graph Description: Environment: libgit2sharp version: 0.24.1 from NuGet .NET version: 4.5 OS: Windows 7, 32 bit. CPU: Intel Core i7 @ 1.8 GHz. storage: local SSD Test case: Clone a large Git repo. (I try with https:/...
X Description: Environment: libgit2sharp version: 0.24.1 from NuGet .NET version: 4.5 OS: Windows 7, 32 bit. CPU: Intel Core i7 @ 1.8 GHz. storage: local SSD Test case: Clone a large Git repo. (I try with https:/...
Opengraph URL: https://github.com/libgit2/libgit2sharp/issues/1558
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"git log -15 is slow","articleBody":"## Environment:\r\nlibgit2sharp version: 0.24.1 from NuGet\r\n.NET version: 4.5\r\nOS: Windows 7, 32 bit.\r\nCPU: Intel Core i7 @ 1.8 GHz.\r\nstorage: local SSD\r\n\r\n## Test case:\r\n1. Clone a large Git repo. (I try with https://github.com/python/cpython ).\r\n1. Run [git log example](https://github.com/libgit2/libgit2sharp/wiki/git-log) on this repo.\r\n\r\n## Expected results:\r\nShould be almost instant, because of \"Take(15)\" is limiting to just 15 commits.\r\nThe time should be similar to running `git log -15 | cat` from command line, which is almost instant to me.\r\n\r\n## Actual results:\r\nIt takes about 1.5-2 seconds to start iterating over the commits.\r\n\r\n## Notes:\r\nThe iteration time doesn't change significantly if you change to Take(10000) or Take(3).\r\nIt seems that it reads the entire history (or a huge chunk of it) into memory before the iteration starts.\r\n\r\nIf have changed the test sample to sleep after every 1000 items. It has shown that there's almost no significant delay for reading over the first 10K after it gets to the first item.\r\n\r\nThe task manager shows that my process takes about 6 Mb before the loop starts, and about 80 Mb on the first line of the loop (Console.WriteLine) right after it starts, which also indicates that.\r\n\r\nAlso this is a screenshot of the .NET profiler that shows that the most of the time is spent inside `NativeMethods.git_revwalk_next`, which I don't know how to profile inside (is it a C function?).\r\n\r\n\r\n\r\n\r\n\r\n_Question:_ Is there a workaround? I would like to get a few commits really fast by something like `Commits.Skip(N).Take(50)`. Is there an alternative API that can be used for this use case? Is there a setting somewhere that tweaks how much of the history does it load/preload internally?\r\n","author":{"url":"https://github.com/battlmonstr","@type":"Person","name":"battlmonstr"},"datePublished":"2018-03-29T14:23:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":14},"url":"https://github.com/1558/libgit2sharp/issues/1558"}
| 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:965fdee0-14ed-0910-9cf1-8f63ca848c8f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CB86:3B1D59:44B721A:5B2CCEB:6A5D71F5 |
| html-safe-nonce | c6a5a206c59d66e4ec95c786ecc0a140d4f70f04a4d06f7906e8db0ba2e31c11 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjg2OjNCMUQ1OTo0NEI3MjFBOjVCMkNDRUI6NkE1RDcxRjUiLCJ2aXNpdG9yX2lkIjoiNTM5NzI2OTk4MzE2ODcyMTgxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b9e66837f2319428395735432924a7b18a2887337c1af5013a0009a91e91960b |
| hovercard-subject-tag | issue:309775384 |
| 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/libgit2sharp/1558/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f6bc9c18cbea07076c78a3c78e1d42d08a4f1ab9a55c145d92cee7285b555178/libgit2/libgit2sharp/issues/1558 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f6bc9c18cbea07076c78a3c78e1d42d08a4f1ab9a55c145d92cee7285b555178/libgit2/libgit2sharp/issues/1558 |
| og:image:alt | Environment: libgit2sharp version: 0.24.1 from NuGet .NET version: 4.5 OS: Windows 7, 32 bit. CPU: Intel Core i7 @ 1.8 GHz. storage: local SSD Test case: Clone a large Git repo. (I try with https:/... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | battlmonstr |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/libgit2/libgit2sharp git https://github.com/libgit2/libgit2sharp.git |
| octolytics-dimension-user_id | 394745 |
| octolytics-dimension-user_login | libgit2 |
| octolytics-dimension-repository_id | 1415168 |
| octolytics-dimension-repository_nwo | libgit2/libgit2sharp |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1415168 |
| octolytics-dimension-repository_network_root_nwo | libgit2/libgit2sharp |
| 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