Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !1627

Merged
Created Oct 03, 2012 by Administrator@rootOwner

Tree performance improvements

  • Overview 27
  • Commits 7
  • Changes 10

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).

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/rspeicher/tree_performance