Project

General

Profile

Actions

Misc #10628

open

Peformance of URI module

Added by tgxworld (Guo Xiang Tan) about 9 years ago. Updated about 9 years ago.


Description

Please view attached screenshot or go to the following link to see benchmark graph over time.

It got slower after this commit.

Hope this helps.


Files

Screenshot from 2014-12-21 22_41_39.png (63.5 KB) Screenshot from 2014-12-21 22_41_39.png tgxworld (Guo Xiang Tan), 12/21/2014 02:41 PM

Updated by normalperson (Eric Wong) about 9 years ago

tgx_world: Please don't use screenshots when a few words explaining the
situation will do. Not everyone can view pics: lack of working GUI,
poor eyesight or danger of opening inappropriate images in public areas.

Fortunately, I was able to open the link to see the issue was with
the bm_app_uri benchmark being slower.

I tried some optimizations, but it's still slower than 2.1.5 on my
Haswell E3-1230 v3 server:

http://80x24.org/spew/m/ugly-uri-optimizations@r48922.txt

Unfortunately, these make evaluating effects of any future compile.c
optimizations more difficult.

benchmark results:
minimum results in each 10 measurements.
Execution time (sec)
name 2.1.5 trunk built
app_uri 0.484 0.584 0.500

Speedup ratio: compare with the result of `2.1.5' (greater is better)
name trunk built
app_uri 0.829 0.968

naruse: any thoughts?

Updated by tgxworld (Guo Xiang Tan) about 9 years ago

Eric Wong wrote:

tgx_world: Please don't use screenshots when a few words explaining the
situation will do. Not everyone can view pics: lack of working GUI,
poor eyesight or danger of opening inappropriate images in public areas.

Fortunately, I was able to open the link to see the issue was with
the bm_app_uri benchmark being slower.

I tried some optimizations, but it's still slower than 2.1.5 on my
Haswell E3-1230 v3 server:

http://80x24.org/spew/m/ugly-uri-optimizations@r48922.txt

Unfortunately, these make evaluating effects of any future compile.c
optimizations more difficult.

benchmark results:
minimum results in each 10 measurements.
Execution time (sec)
name 2.1.5 trunk built
app_uri 0.484 0.584 0.500

Speedup ratio: compare with the result of `2.1.5' (greater is better)
name trunk built
app_uri 0.829 0.968

naruse: any thoughts?

Opps got it. I'll try to explain better in words next time.

Updated by naruse (Yui NARUSE) about 9 years ago

The benchmark consists about two parts: split and new.

In split, the difference of its regexp seems the cause of slow down (for example backtracks of userinfo.
It can be optimized.

In new, some checks are always enabled; it is feature.

require 'uri'

100_000.times{
  scheme, userinfo, host, port,
    registry, path, opaque, query, fragment = URI.split('http://www.ruby-lang.org')
  URI::HTTP.new(scheme, userinfo, host, port,
                                     registry, path, opaque, query,
                                     fragment, URI,false)
}

Updated by naruse (Yui NARUSE) about 9 years ago

Anyway I'm ok for Eric's patch.
Could you commit it?

We should consider ext/uri or strict/loose API for Ruby 2.3.

Updated by normalperson (Eric Wong) about 9 years ago

wrote:

Anyway I'm ok for Eric's patch.
Could you commit it?

r48980

We should consider ext/uri or strict/loose API for Ruby 2.3.

We should be able to improve compile.c to do more optimizations.
I prefer to avoid any new C-exts.

Things like [Feature #10423] (reduce string literal allocations).
Also, this patch gave me a new ideas: we should be able to merge/share
nearby call_info structs on the same object. For example:

m["a"], m["b"], m["c"]

May all use the same call_info object, I think:

{:mid=>:[], :flag=>256, :blockptr=>nil, :orig_argc=>1},

This can improve IC hit rates and reduce memory.

Updated by tgxworld (Guo Xiang Tan) about 9 years ago

Latest results so far after the patch :)

https://railsbench.herokuapp.com/tgxworld/ruby?utf8=%E2%9C%93&result_types%5B%5D=app_uri&commit=Submit

Do let me know if you need any more information. Happy holidays!

Updated by normalperson (Eric Wong) about 9 years ago

wrote:

Latest results so far after the patch :)

https://railsbench.herokuapp.com/tgxworld/ruby?utf8=%E2%9C%93&result_types%5B%5D=app_uri&commit=Submit

Do let me know if you need any more information. Happy holidays!

I actually can't see results in my text-only browser, just that
bm_app_uri is selected. Can you just show us numbers? Thanks.

Updated by tgxworld (Guo Xiang Tan) about 9 years ago

Eric Wong wrote:

wrote:

Latest results so far after the patch :)

https://railsbench.herokuapp.com/tgxworld/ruby?utf8=%E2%9C%93&result_types%5B%5D=app_uri&commit=Submit

Do let me know if you need any more information. Happy holidays!

I actually can't see results in my text-only browser, just that
bm_app_uri is selected. Can you just show us numbers? Thanks.

On my builder, these are the following results:
before regression: 0.97
regression: 1.1 ~ 1.2
after patch: 1.0

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0