-
Notifications
You must be signed in to change notification settings - Fork 167
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
Improve performance #437
Improve performance #437
Conversation
I've written a small script that benchmarks the performance of reading (getting Results:On
|
As we can see the changes on this branch improve performance drastically, except for the case of writing files, for some reason. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sound. Great speedups!
* Don't use treemap for finding pages and file * Reimplement global find * Ensure File.canonical_pat prevents path traversal. Add test. * GitAccess: improve #tree! performance * Expect file mode to be an Integer * Refactor Page and File to use Pathname * file.rb: remove unneeded version.to_s call (see gollum/gollum#1972) * Provide compatibility with latest minitest.
In response to gollum/gollum#1940 (comment) I did some profiling and saw that a lot of time was being spent in the
Gollum::File.find
, iterating over entries in the treemap. Basically, gollum currently iterates over a Hash representation of all the blobs and trees in the repo (at a given commit). In a large repo, this means looping a long time (plus all the inefficiencies derived from instantiating objects associated with each entry in the repo). I decided to hack together another approach that does not rely on a treemap, and it was relatively straightforward to do.Here are some quick profiling results, loading a page from the
nlab-conten
wiki referred to by @felixwellen:*master: 26653ms
(I used https://github.com/MiniProfiler/rack-mini-profiler to profile)
On a smaller repo (our
lotr.git
), tested with rugged, the speed increase is not noticeable (but I don't think it's any slower either ;)).Feedback welcome!
Todo: