<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/gitlab/gitlab-ce.git/lib/banzai, branch scroll-code-blocks</title>
<subtitle>gitlab.com: gitlab-org/gitlab-ce.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/'/>
<entry>
<title>Merge branch 'relative-link-filter-ref' into 'master'</title>
<updated>2016-08-09T21:45:59+00:00</updated>
<author>
<name>Robert Speicher</name>
<email>robert@gitlab.com</email>
</author>
<published>2016-08-09T21:45:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=bd1b8ae9bbbe8c81d5f1c18a5c8d86fbcb4f1dbf'/>
<id>bd1b8ae9bbbe8c81d5f1c18a5c8d86fbcb4f1dbf</id>
<content type='text'>

Do not look up commit again when it is passed to RelativeLinkFilter

## What does this MR do?

Use `context[:commit]` in RelativeLinkFilter instead of looking up commit using `context[:ref]`.

## Why was this MR needed?

Even though the commit object was already passed, unnecessary I/O is done to retrieve the commit object.

## What are the relevant issue numbers?

Fixes #20026

See merge request !5455</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>

Do not look up commit again when it is passed to RelativeLinkFilter

## What does this MR do?

Use `context[:commit]` in RelativeLinkFilter instead of looking up commit using `context[:ref]`.

## Why was this MR needed?

Even though the commit object was already passed, unnecessary I/O is done to retrieve the commit object.

## What are the relevant issue numbers?

Fixes #20026

See merge request !5455</pre>
</div>
</content>
</entry>
<entry>
<title>Enable Style/EmptyLinesAroundClassBody cop</title>
<updated>2016-08-06T01:52:24+00:00</updated>
<author>
<name>Gabriel Mazetto</name>
<email>gabriel@gitlab.com</email>
</author>
<published>2016-08-06T01:52:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=5f6223cf9f285da3814991d1271e328e23be9d45'/>
<id>5f6223cf9f285da3814991d1271e328e23be9d45</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Enable Style/EmptyLinesAroundModuleBody cop</title>
<updated>2016-08-06T01:44:39+00:00</updated>
<author>
<name>Gabriel Mazetto</name>
<email>gabriel@gitlab.com</email>
</author>
<published>2016-08-06T01:44:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=2aa2f52191b746df851853cf5fe9ce7249a70739'/>
<id>2aa2f52191b746df851853cf5fe9ce7249a70739</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Ignore URLs starting with // (!5677)</title>
<updated>2016-08-04T23:30:59+00:00</updated>
<author>
<name>winniehell</name>
<email>git@winniehell.de</email>
</author>
<published>2016-08-04T23:22:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=b791dcc05b379a64c1370bc4be8d0aac60b9c31b'/>
<id>b791dcc05b379a64c1370bc4be8d0aac60b9c31b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'syntax-highlight-filter-performance' into 'master'</title>
<updated>2016-08-04T10:13:39+00:00</updated>
<author>
<name>Rémy Coutable</name>
<email>remy@rymai.me</email>
</author>
<published>2016-08-04T10:13:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=6ffafc79460bcfef29d8a1b3a30e8a1104f94d32'/>
<id>6ffafc79460bcfef29d8a1b3a30e8a1104f94d32</id>
<content type='text'>

Improve performance of SyntaxHighlightFilter

## What does this MR do?

This MR improves the performance of `Banzai::Filter::SyntaxHighlightFilter`. See e9bacc6575d0002c6cab620075dea3dc7f93f100 for more information.

## Are there points in the code the reviewer needs to double check?

Styling mostly.

## Why was this MR needed?

Syntax highlighting is rather slow.

## What are the relevant issue numbers?

#18592 

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [x] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- [x] ~~API support added~~
- Tests
  - [x] ~~Added for this feature/bug~~
  - [ ] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5643</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>

Improve performance of SyntaxHighlightFilter

## What does this MR do?

This MR improves the performance of `Banzai::Filter::SyntaxHighlightFilter`. See e9bacc6575d0002c6cab620075dea3dc7f93f100 for more information.

## Are there points in the code the reviewer needs to double check?

Styling mostly.

## Why was this MR needed?

Syntax highlighting is rather slow.

## What are the relevant issue numbers?

#18592 

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [x] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- [x] ~~API support added~~
- Tests
  - [x] ~~Added for this feature/bug~~
  - [ ] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5643</pre>
</div>
</content>
</entry>
<entry>
<title>Improve performance of SyntaxHighlightFilter</title>
<updated>2016-08-03T14:58:20+00:00</updated>
<author>
<name>Yorick Peterse</name>
<email>yorickpeterse@gmail.com</email>
</author>
<published>2016-08-03T14:52:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=038d6febedc03280bd686d929057c02d05f2afd6'/>
<id>038d6febedc03280bd686d929057c02d05f2afd6</id>
<content type='text'>
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 &lt;&lt; &lt;&lt;-EOF
      &lt;pre&gt;&lt;code class="ruby"&gt;#{File.read(controller).strip}&lt;/code&gt;&lt;/pre&gt;

      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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;&lt; &lt;&lt;-EOF
      &lt;pre&gt;&lt;code class="ruby"&gt;#{File.read(controller).strip}&lt;/code&gt;&lt;/pre&gt;

      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.
</pre>
</div>
</content>
</entry>
<entry>
<title>Improve AutolinkFilter#text_parse performance</title>
<updated>2016-08-03T09:38:46+00:00</updated>
<author>
<name>Yorick Peterse</name>
<email>yorickpeterse@gmail.com</email>
</author>
<published>2016-08-02T15:51:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=dd35c3ddf6dce7a69cc116fe6165dad68b8e9251'/>
<id>dd35c3ddf6dce7a69cc116fe6165dad68b8e9251</id>
<content type='text'>
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 = '&lt;p&gt;' + Note.select("string_agg(note, '') AS note").limit(50).take[:note] + '&lt;/p&gt;'
    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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 = '&lt;p&gt;' + Note.select("string_agg(note, '') AS note").limit(50).take[:note] + '&lt;/p&gt;'
    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.
</pre>
</div>
</content>
</entry>
<entry>
<title>Do not look up commit again when it is passed to RelativeLinkFilter (!5455)</title>
<updated>2016-08-02T19:52:52+00:00</updated>
<author>
<name>winniehell</name>
<email>git@winniehell.de</email>
</author>
<published>2016-08-01T00:43:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=e63eccf9744de0965d4727326a4b30f1fe8165e8'/>
<id>e63eccf9744de0965d4727326a4b30f1fe8165e8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add support for relative links starting with ./ or / to RelativeLinkFilter (!5586)</title>
<updated>2016-08-02T01:52:24+00:00</updated>
<author>
<name>winniehell</name>
<email>git@winniehell.de</email>
</author>
<published>2016-08-01T02:52:05+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=40da543f2fddefcdebf12e52425314355a16a57d'/>
<id>40da543f2fddefcdebf12e52425314355a16a57d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'ability-batch-issue-checking' into 'master'</title>
<updated>2016-07-29T16:54:37+00:00</updated>
<author>
<name>Robert Speicher</name>
<email>robert@gitlab.com</email>
</author>
<published>2016-07-29T16:54:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=dac2e0c43d8ca3e4c593a230dcef4eb9918a4263'/>
<id>dac2e0c43d8ca3e4c593a230dcef4eb9918a4263</id>
<content type='text'>

Optimize checking if a user can read multiple issues

## What does this MR do?

This optimizes various parts of the code so it can more efficiently check if a user can read a list of issues.

## Are there points in the code the reviewer needs to double check?

Yes, in particular `Ability.issues_readable_by_user` should be checked to make sure it correctly allows/restricts access to issues.

## Why was this MR needed?

Currently the general approach to checking if one can read an issue is to iterate over the issues to check and call `can?(user, :read_issue, issue)` for every issue. This is not efficient as the same work has to be done for every issue.

## What are the relevant issue numbers?

* #15607 
* #17463

See merge request !5370</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>

Optimize checking if a user can read multiple issues

## What does this MR do?

This optimizes various parts of the code so it can more efficiently check if a user can read a list of issues.

## Are there points in the code the reviewer needs to double check?

Yes, in particular `Ability.issues_readable_by_user` should be checked to make sure it correctly allows/restricts access to issues.

## Why was this MR needed?

Currently the general approach to checking if one can read an issue is to iterate over the issues to check and call `can?(user, :read_issue, issue)` for every issue. This is not efficient as the same work has to be done for every issue.

## What are the relevant issue numbers?

* #15607 
* #17463

See merge request !5370</pre>
</div>
</content>
</entry>
</feed>
