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

Implement a commit hash based cache of local package versions. #692

Merged
merged 3 commits into from
Sep 23, 2015

Conversation

s-ludwig
Copy link
Member

To speed up the initialization process, this PR adds a file .dub/version.json that contains the last known pair of commit hash and version of a particular local GIT working copy. The current commit hash is then determined manually by reading the appropriate files in .git .

Open issues:

  • Can yield wrong results if tags to existing commits get added/changed/removed after the version has been cached
  • Currently doesn't read the "packed-refs" file, so mail fail on some repositories (which just means that it won't be able to hit the fast path)

@MartinNowak
Copy link
Member

Please always make sure to synchronize disk caches.
#683

@MartinNowak
Copy link
Member

The git command usually runs in 1ms for me, sure we need a cache?

@s-ludwig
Copy link
Member Author

On Windows it can take considerable time due to pure process startup. Might make sense to restrict the optimization to Windows. I'll change the storage procedure to "atomically" perform save->delete->rename.

@s-ludwig
Copy link
Member Author

A best-of-10 benchmark of dub list with 35 local working copies registered yields 275 ms 119 ms for the cached version and 1344 ms for the uncached one (Windows). I'll do a test on Linux later, but for Windows it's definitely worth it.

@s-ludwig
Copy link
Member Author

Linux, for 17 working copies, yields 39 ms for the caching version and 89 ms for the uncached version (again best of 10). So it might be an improvement for people with large numbers of local working copies, but I'd be fine with restricting it to Windows-only.

@s-ludwig s-ludwig force-pushed the faster-local-versions branch from 88e3f26 to ee4f42e Compare September 22, 2015 07:45
Writes to a temp file and then replaces (delete+rename) the target file, so that it always contains complete and valid contents.
@s-ludwig s-ludwig force-pushed the faster-local-versions branch from ee4f42e to 6a6e9ba Compare September 22, 2015 07:48
MartinNowak added a commit that referenced this pull request Sep 23, 2015
…ions

Implement a commit hash based cache of local package versions.
@MartinNowak MartinNowak merged commit e65f132 into master Sep 23, 2015
@MartinNowak MartinNowak deleted the faster-local-versions branch September 23, 2015 09:28
@MartinNowak
Copy link
Member

I reused atomicWriteJsonFile for #683.

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

Successfully merging this pull request may close these issues.

2 participants