Skip to content
Snippets Groups Projects

Tree performance improvements

Merged gitlab-qa-bot requested to merge github/fork/rspeicher/tree_performance into master

Created by: rspeicher

After speeding up the Commits page a bit, I started on the Tree page.

Surprisingly, the single biggest bottleneck was the tree_icon helper. I simplified it, but at the cost of only having two icons: one for folders, one for not-folders. I think it's a worthy tradeoff.

Benchmark code

# Run tree_icon on GitLab's root tree 10 times

require 'benchmark'
require_relative 'config/environment'

p = Project.find_by_code('gitlabhq')
t = p.repo.tree.contents

include TreeHelper

def image_tag(*args)
end

Benchmark.bm do |x|
  x.report { 10.times { t.each { |v| tree_icon(v) } } }
end

Results:

master          1.590000  24.690000  26.280000 ( 26.290603)
performance     0.000000   0.000000   0.000000 (  0.000202)

Crazy, right?

The rest of the PR is just some refactoring of the tree views. Removes a bunch of logic from them that either wasn't necessary or better fit in a helper.

Finally, I updated Grit to the 2.5.0 official gem (I did it looking for any performance improvements, but we might as well switch to it anyway).

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Created by: dzaporozhets

    Official grit has invalid parse for some commit messages earlier

    By Administrator on 2012-10-04T05:26:51 (imported from GitLab project)

    By Administrator on 2012-10-04T05:26:51 (imported from GitLab)

  • Created by: dzaporozhets

    Thats why we use own fork https://github.com/gitlabhq/grit/commit/810e3c11787e9d84c5925a7edc3264db0f04bb49

    By Administrator on 2012-10-04T08:18:21 (imported from GitLab project)

    By Administrator on 2012-10-04T08:18:21 (imported from GitLab)

  • Created by: rspeicher

    Then why not fix it for those invalid parses and submit a pull request to the official repo?

    By Administrator on 2012-10-04T18:21:30 (imported from GitLab project)

    By Administrator on 2012-10-04T18:21:30 (imported from GitLab)

  • Created by: riyad

    @tsigo I was thinking the same thing. :)

    By Administrator on 2012-10-04T19:14:35 (imported from GitLab project)

    By Administrator on 2012-10-04T19:14:35 (imported from GitLab)

  • Created by: dubcanada

    Not that I am against pull requesting the official repo, the official repo has 47 pull requests most of which have no comments and the last file change was over 6 months ago.

    Even if it was submitted it would probably take a while to ever be included so the need to use the official Grit would still need to exist for a while.

    By Administrator on 2012-10-05T17:57:30 (imported from GitLab project)

    By Administrator on 2012-10-05T17:57:30 (imported from GitLab)

  • Created by: NARKOZ

    What @dubcanada said. Grit no more in active development.

    By Administrator on 2012-10-08T09:28:36 (imported from GitLab project)

    By Administrator on 2012-10-08T09:28:36 (imported from GitLab)

  • Created by: vsizov

    We are going to migrate to https://github.com/schacon/libgit soon. But it is too much work ;)

    By Administrator on 2012-10-08T11:55:03 (imported from GitLab project)

    By Administrator on 2012-10-08T11:55:03 (imported from GitLab)

  • Created by: vsizov

    sorry http://libgit2.github.com/

    By Administrator on 2012-10-08T11:55:56 (imported from GitLab project)

    By Administrator on 2012-10-08T11:55:56 (imported from GitLab)

  • Created by: dzaporozhets

    Anyway for now we'll use our grit fork & this PR should be reviewed/tested and applied. Two icons instead of 3 is ok in compare to increased perfomance

    By Administrator on 2012-10-08T12:19:18 (imported from GitLab project)

    By Administrator on 2012-10-08T12:19:18 (imported from GitLab)

  • Created by: vsizov

    Thanks

    By Administrator on 2012-10-08T12:36:42 (imported from GitLab project)

    By Administrator on 2012-10-08T12:36:42 (imported from GitLab)

  • Created by: dzaporozhets

    @tsigo thank you :)

    By Administrator on 2012-10-08T12:50:46 (imported from GitLab project)

    By Administrator on 2012-10-08T12:50:46 (imported from GitLab)

  • Created by: SaitoWu

    @randx @vsizov we are going to migrate to rugged?

    I just want to use grit to improve the MR , no need the satellite any more.

    code is just like this: https://github.com/mojombo/grit/blob/master/test/test_git_patching.rb#L21..L38

    By Administrator on 2012-10-08T13:04:07 (imported from GitLab project)

    By Administrator on 2012-10-08T13:04:07 (imported from GitLab)

  • Created by: dzaporozhets

    not yet. Its like far future for me. Waiting for PR :)

    By Administrator on 2012-10-08T13:07:50 (imported from GitLab project)

    By Administrator on 2012-10-08T13:07:50 (imported from GitLab)

  • Created by: vsizov

    I'm currently writing a web editor for GitLab and git_patching really interesting feature for me too. But I don't know, maybe we shouldn't tie on grit specific features. Because someday we will migrate to rugged anyway. Any thoughts?

    By Administrator on 2012-10-08T16:34:59 (imported from GitLab project)

    By Administrator on 2012-10-08T16:34:59 (imported from GitLab)

  • Created by: SaitoWu

    @vsizov Grit is a git command line wrapper, it use git write_tree command to apply a patch. and we need to use a commit_tree command to commit that tree.

    If rugged has write_tree and commit_tree command implementation. I think its ok, not so specific.

    By Administrator on 2012-10-08T16:25:40 (imported from GitLab project)

    By Administrator on 2012-10-08T16:25:40 (imported from GitLab)

  • Created by: vsizov

    yes, rugged has tree and commit

    By Administrator on 2012-10-08T16:30:08 (imported from GitLab project)

    By Administrator on 2012-10-08T16:30:08 (imported from GitLab)

  • Created by: SaitoWu

    That's a lot of work, if we decide to migrate.

    By Administrator on 2012-10-08T16:39:21 (imported from GitLab project)

    By Administrator on 2012-10-08T16:39:21 (imported from GitLab)

  • Created by: vsizov

    Yes. We should benchmark performance of Grit and Rugged as well as do profiling of GitLab to understanding if we really need to migrate.

    By Administrator on 2012-10-08T16:46:17 (imported from GitLab project)

    By Administrator on 2012-10-08T16:46:17 (imported from GitLab)

  • Created by: riyad

    Does any one know how compatible their APIs are?

    By Administrator on 2012-10-09T09:47:30 (imported from GitLab project)

    By Administrator on 2012-10-09T09:47:30 (imported from GitLab)

  • Created by: vsizov

    There is no compatibility

    By Administrator on 2012-10-09T12:01:52 (imported from GitLab project)

    By Administrator on 2012-10-09T12:01:52 (imported from GitLab)

  • Created by: vsizov

    @SaitoWu The git_patching requires do clone. But one reason why we've created satellites is that one is extremely fast. Because it is never doing git clone.

    By Administrator on 2012-10-10T14:32:15 (imported from GitLab project)

    By Administrator on 2012-10-10T14:32:15 (imported from GitLab)

  • Created by: SaitoWu

    @vsizov No, we don't need do a clone.

    you can see my test on this gist: https://gist.github.com/3853774

    u can use apply_patch cross two repos. or use it in one.

    By Administrator on 2012-10-10T14:56:02 (imported from GitLab project)

    By Administrator on 2012-10-10T14:56:02 (imported from GitLab)

  • Created by: vsizov

    @SaitoWu but we have bare repo in gitlab! What if I want to create patch directly on the server? For example for web editor.

    By Administrator on 2012-10-10T15:38:02 (imported from GitLab project)

    By Administrator on 2012-10-10T15:38:02 (imported from GitLab)

  • Created by: vsizov

    @SaitoWu I believe we can use class Tree for that.

    By Administrator on 2012-10-10T15:41:15 (imported from GitLab project)

    By Administrator on 2012-10-10T15:41:15 (imported from GitLab)

  • Created by: vsizov

    @SaitoWu But i don't know how exactly we should do it. I will think about it.

    By Administrator on 2012-10-10T15:46:14 (imported from GitLab project)

    By Administrator on 2012-10-10T15:46:14 (imported from GitLab)

  • Created by: SaitoWu

    @vsizov create a patch on server is easy i think.

    Just create a new uniq name branch, like patch-1 or whatever. edit and commit it( edit from web, commit by grit.

    Open a MR.

    Master review and merge it.

    By Administrator on 2012-10-10T15:51:17 (imported from GitLab project)

    By Administrator on 2012-10-10T15:51:17 (imported from GitLab)

  • Created by: vsizov

    Yes, you are right.

    By Administrator on 2012-10-10T16:27:51 (imported from GitLab project)

    By Administrator on 2012-10-10T16:27:51 (imported from GitLab)

Please register or sign in to reply
Loading