1. 05 Aug, 2016 3 commits
  2. 04 Aug, 2016 9 commits
  3. 03 Aug, 2016 12 commits
    • Alejandro Rodríguez's avatar
    • Clement Ho's avatar
      Remove unused images · c887a131
      Clement Ho authored
      c887a131
    • Connor Shea's avatar
      602fe111
    • Ahmad Sherif's avatar
      08c1dd34
    • Stan Hu's avatar
    • Ahmad Sherif's avatar
      Speed up Commit#repo_changes · a16c26c9
      Ahmad Sherif authored
      a16c26c9
    • Yorick Peterse's avatar
      Instrument Gitlab::Highlight · 9a934e25
      Yorick Peterse authored
      This class does quite a few interesting things so let's instrument it so
      we can see how much time is being spent in this class.
      9a934e25
    • Yorick Peterse's avatar
      Improve performance of SyntaxHighlightFilter · 038d6feb
      Yorick Peterse authored
      By using Rouge::Lexer.find instead of find_fancy() and memoizing the
      HTML formatter we can speed up the highlighting process by between 1.7
      and 1.8 times (at least when measured using synthetic benchmarks). To
      measure this I used the following benchmark:
      
          require 'benchmark/ips'
      
          input = ''
      
          Dir['./app/controllers/**/*.rb'].each do |controller|
            input << <<-EOF
            <pre><code class="ruby">#{File.read(controller).strip}</code></pre>
      
            EOF
          end
      
          document = Nokogiri::HTML.fragment(input)
          filter = Banzai::Filter::SyntaxHighlightFilter.new(document)
      
          puts "Input size: #{(input.bytesize.to_f / 1024).round(2)} KB"
      
          Benchmark.ips do |bench|
            bench.report 'call' do
              filter.call
            end
          end
      
      This benchmark produces 250 KB of input. Before these changes the timing
      output would be as follows:
      
          Calculating -------------------------------------
                          call     1.000  i/100ms
          -------------------------------------------------
                          call     22.439  (±35.7%) i/s -     93.000
      
      After these changes the output instead is as follows:
      
      Calculating -------------------------------------
                      call     1.000  i/100ms
      -------------------------------------------------
                      call     41.283  (±38.8%) i/s -    148.000
      
      Note that due to the fairly high standard deviation and this being a
      synthetic benchmark it's entirely possible the real-world improvements
      are smaller.
      038d6feb
    • James Lopez's avatar
      Fix Import/Export error checking versions · f87eb250
      James Lopez authored
      f87eb250
    • Yorick Peterse's avatar
      Improve AutolinkFilter#text_parse performance · dd35c3dd
      Yorick Peterse authored
      By using clever XPath queries we can quite significantly improve the
      performance of this method. The actual improvement depends a bit on the
      amount of links used but in my tests the new implementation is usually
      around 8 times faster than the old one. This was measured using the
      following benchmark:
      
          require 'benchmark/ips'
      
          text = '<p>' + Note.select("string_agg(note, '') AS note").limit(50).take[:note] + '</p>'
          document = Nokogiri::HTML.fragment(text)
          filter = Banzai::Filter::AutolinkFilter.new(document, autolink: true)
      
          puts "Input size: #{(text.bytesize.to_f / 1024 / 1024).round(2)} MB"
      
          filter.rinku_parse
      
          Benchmark.ips(time: 15) do |bench|
            bench.report 'text_parse' do
              filter.text_parse
            end
      
            bench.report 'text_parse_fast' do
              filter.text_parse_fast
            end
      
            bench.compare!
          end
      
      Here the "text_parse_fast" method is the new implementation and
      "text_parse" the old one. The input size was around 180 MB. Running this
      benchmark outputs the following:
      
          Input size: 181.16 MB
          Calculating -------------------------------------
                    text_parse     1.000  i/100ms
               text_parse_fast     9.000  i/100ms
          -------------------------------------------------
                    text_parse     13.021  (±15.4%) i/s -    188.000
               text_parse_fast    112.741  (± 3.5%) i/s -      1.692k
      
          Comparison:
               text_parse_fast:      112.7 i/s
                    text_parse:       13.0 i/s - 8.66x slower
      
      Again the production timings may (and most likely will) vary depending
      on the input being processed.
      dd35c3dd
    • Paco Guzman's avatar
      Cache highlighted diff lines for merge requests · cd7c2cb6
      Paco Guzman authored
      Introducing the concept of SafeDiffs which relates 
      diffs with UI highlighting.
      cd7c2cb6
    • Clement Ho's avatar
      Fix filter input alignment · 51bcdfb7
      Clement Ho authored
      51bcdfb7
  4. 02 Aug, 2016 9 commits
  5. 01 Aug, 2016 7 commits