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

RFC: Speed up Pkg.update() #11137

Merged
merged 1 commit into from May 6, 2015
Merged

Conversation

ncnc
Copy link
Contributor

@ncnc ncnc commented May 5, 2015

I get a major speed improvement in Pkg.update() with this patch. The idea is to use git log --all to extract all valid hashes instead of calling git on every single hash. This can be used in Cache.prefetch(), which currently makes multiple passes through every version of every installed package.

It would probably be good to get some independent testing before merging.

Should improve #9944 somewhat, will eventually be superceded by #7584 (libgit2).

@tkelman tkelman added the packages Package management and loading label May 5, 2015
@@ -58,6 +58,10 @@ attached(; dir="") = success(`symbolic-ref -q HEAD`, dir=dir)
branch(; dir="") = readchomp(`rev-parse --symbolic-full-name --abbrev-ref HEAD`, dir=dir)
head(; dir="") = readchomp(`rev-parse HEAD`, dir=dir)

function iscommit(sha1s::Array{ASCIIString}; dir="")
indexin(sha1s,split(readchomp(`log --all --format=%H`, dir=dir),"\n")).!=0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check whether the latest versions of git, 2.3, 2.4 etc still accept --format ? The docs for recent versions are a bit ambiguous.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--format still works for me on 2.4.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, 2.4.0 seems to behave the same way as the older version I've been using.

@StefanKarpinski
Copy link
Sponsor Member

+1 – good approach if this works for all various versions of git

@ncnc
Copy link
Contributor Author

ncnc commented May 5, 2015

I made some minor cleanups and rebased.

I removed the unnecessary find and made the signature of the vectorized iscommit more generic, since there are both ASCIIString and AbstractString variables floating around.

jakebolewski added a commit that referenced this pull request May 6, 2015
@jakebolewski jakebolewski merged commit 90f7cd0 into JuliaLang:master May 6, 2015
@tkelman
Copy link
Contributor

tkelman commented May 20, 2015

nominating for potential backport, unless there are objections

@tkelman tkelman mentioned this pull request May 21, 2015
2 tasks
tkelman pushed a commit that referenced this pull request May 23, 2015
…) and using it in Cache.prefetch().

(cherry picked from commit f5cd1e3)
ref PR #11137
@tkelman
Copy link
Contributor

tkelman commented May 23, 2015

backported in a946283

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

Successfully merging this pull request may close these issues.

None yet

5 participants