<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/benchmark, branch ruby_2_7</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Remove unneeded exec bits from some files</title>
<updated>2019-11-09T12:36:30+00:00</updated>
<author>
<name>David Rodríguez</name>
<email>deivid.rodriguez@riseup.net</email>
</author>
<published>2019-11-08T14:03:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f48655d04d463a89b7ac15bc3942ec6c574c6cd9'/>
<id>f48655d04d463a89b7ac15bc3942ec6c574c6cd9</id>
<content type='text'>
I noticed that some files in rubygems were executable, and I could think
of no reason why they should be.

In general, I think ruby files should never have the executable bit set
unless they include a shebang, so I run the following command over the
whole repo:

```bash
find . -name '*.rb' -type f -executable -exec bash -c 'grep -L "^#!" $1 || chmod -x $1' _ {} \;
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I noticed that some files in rubygems were executable, and I could think
of no reason why they should be.

In general, I think ruby files should never have the executable bit set
unless they include a shebang, so I run the following command over the
whole repo:

```bash
find . -name '*.rb' -type f -executable -exec bash -c 'grep -L "^#!" $1 || chmod -x $1' _ {} \;
```
</pre>
</div>
</content>
</entry>
<entry>
<title>Benchmark for [Feature #16155]</title>
<updated>2019-10-22T13:49:48+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2019-10-22T13:49:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8390057d1ee9acd67ac9f36dee59f500b1f1bc5f'/>
<id>8390057d1ee9acd67ac9f36dee59f500b1f1bc5f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Stop making a redundant hash copy in Hash#dup (#2489)</title>
<updated>2019-10-21T08:29:21+00:00</updated>
<author>
<name>Dylan Thacker-Smith</name>
<email>dylan.smith@shopify.com</email>
</author>
<published>2019-10-21T08:29:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b9702590445dfea62d271d0a5c942b7adfaaacdd'/>
<id>b9702590445dfea62d271d0a5c942b7adfaaacdd</id>
<content type='text'>
* Stop making a redundant hash copy in Hash#dup

It was making a copy of the hash without rehashing, then created an
extra copy of the hash to do the rehashing.  Since rehashing creates
a new copy already, this change just uses that rehashing to make
the copy.

[Bug #16121]

* Remove redundant Check_Type after to_hash

* Fix freeing and clearing destination hash in Hash#initialize_copy

The code was assuming the state of the destination hash based on the
source hash for clearing any existing table on it. If these don't match,
then that can cause the old table to be leaked. This can be seen by
compiling hash.c with `#define HASH_DEBUG 1` and running the following
script, which will crash from a debug assertion.

```ruby
h = 9.times.map { |i| [i, i] }.to_h
h.send(:initialize_copy, {})
```

* Remove dead code paths in rb_hash_initialize_copy

Given that `RHASH_ST_TABLE_P(h)` is defined as `(!RHASH_AR_TABLE_P(h))`
it shouldn't be possible for a hash to be neither of these, so there
is no need for the removed `else if` blocks.

* Share implementation between Hash#replace and Hash#initialize_copy

This also fixes key rehashing for small hashes backed by an array
table for Hash#replace.  This used to be done consistently in ruby
2.5.x, but stopped being done for small arrays in ruby 2.6.x.

This also bring optimization improvements that were done for
Hash#initialize_copy to Hash#replace.

* Add the Hash#dup benchmark
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Stop making a redundant hash copy in Hash#dup

It was making a copy of the hash without rehashing, then created an
extra copy of the hash to do the rehashing.  Since rehashing creates
a new copy already, this change just uses that rehashing to make
the copy.

[Bug #16121]

* Remove redundant Check_Type after to_hash

* Fix freeing and clearing destination hash in Hash#initialize_copy

The code was assuming the state of the destination hash based on the
source hash for clearing any existing table on it. If these don't match,
then that can cause the old table to be leaked. This can be seen by
compiling hash.c with `#define HASH_DEBUG 1` and running the following
script, which will crash from a debug assertion.

```ruby
h = 9.times.map { |i| [i, i] }.to_h
h.send(:initialize_copy, {})
```

* Remove dead code paths in rb_hash_initialize_copy

Given that `RHASH_ST_TABLE_P(h)` is defined as `(!RHASH_AR_TABLE_P(h))`
it shouldn't be possible for a hash to be neither of these, so there
is no need for the removed `else if` blocks.

* Share implementation between Hash#replace and Hash#initialize_copy

This also fixes key rehashing for small hashes backed by an array
table for Hash#replace.  This used to be done consistently in ruby
2.5.x, but stopped being done for small arrays in ruby 2.6.x.

This also bring optimization improvements that were done for
Hash#initialize_copy to Hash#replace.

* Add the Hash#dup benchmark
</pre>
</div>
</content>
</entry>
<entry>
<title>Optimize Array#flatten and flatten! for already flattened arrays (#2495)</title>
<updated>2019-09-27T16:24:24+00:00</updated>
<author>
<name>Dylan Thacker-Smith</name>
<email>dylan.smith@shopify.com</email>
</author>
<published>2019-09-27T16:24:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a1fda16b238f24cf55814ecc18f716cbfff8dd91'/>
<id>a1fda16b238f24cf55814ecc18f716cbfff8dd91</id>
<content type='text'>
* Optimize Array#flatten and flatten! for already flattened arrays
* Add benchmark for Array#flatten and Array#flatten!

[Bug #16119]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Optimize Array#flatten and flatten! for already flattened arrays
* Add benchmark for Array#flatten and Array#flatten!

[Bug #16119]
</pre>
</div>
</content>
</entry>
<entry>
<title>Reduce ISeq size of mjit_exec benchmark</title>
<updated>2019-09-26T13:13:31+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2019-09-26T13:13:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=41e3c204fd83660a243fa61f91aeda2a78817a97'/>
<id>41e3c204fd83660a243fa61f91aeda2a78817a97</id>
<content type='text'>
to avoid unwanted memory pressure
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
to avoid unwanted memory pressure
</pre>
</div>
</content>
</entry>
<entry>
<title>Add special runner to benchmark mjit_exec</title>
<updated>2019-09-26T07:34:40+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2019-09-26T03:57:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4a4c5028258e53f3395af29655a66bcef796fd73'/>
<id>4a4c5028258e53f3395af29655a66bcef796fd73</id>
<content type='text'>
I wanted to dynamically generate benchmark cases to test various number
of methods. Thus I added a dedicated runner of benchmark-driver.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I wanted to dynamically generate benchmark cases to test various number
of methods. Thus I added a dedicated runner of benchmark-driver.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add a benchmark for JIT-ed code dispatch</title>
<updated>2019-09-21T07:09:52+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2019-09-21T07:09:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b4149993709169b9a67373095593da385e7d48e5'/>
<id>b4149993709169b9a67373095593da385e7d48e5</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>reuse cc-&gt;call</title>
<updated>2019-09-19T06:18:10+00:00</updated>
<author>
<name>卜部昌平</name>
<email>shyouhei@ruby-lang.org</email>
</author>
<published>2019-09-18T08:18:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d74fa8e55ce64904f2f99dfef4cbdff94e290672'/>
<id>d74fa8e55ce64904f2f99dfef4cbdff94e290672</id>
<content type='text'>
I noticed that in case of cache misshit, re-calculated cc-&gt;me can
be the same method entry than the pevious one.  That is an okay
situation but can't we partially reuse the cache, because cc-&gt;call
should still be valid then?

One thing that has to be special-cased is when the method entry
gets amended by some refinements.  That happens behind-the-scene
of call cache mechanism.  We have to check if cc-&gt;me-&gt;def points to
the previously saved one.

Calculating -------------------------------------
                          trunk        ours
vm2_poly_same_method     1.534M      2.025M i/s -      6.000M times in 3.910203s 2.962752s

Comparison:
             vm2_poly_same_method
                ours:   2025143.9 i/s
               trunk:   1534447.2 i/s - 1.32x  slower
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I noticed that in case of cache misshit, re-calculated cc-&gt;me can
be the same method entry than the pevious one.  That is an okay
situation but can't we partially reuse the cache, because cc-&gt;call
should still be valid then?

One thing that has to be special-cased is when the method entry
gets amended by some refinements.  That happens behind-the-scene
of call cache mechanism.  We have to check if cc-&gt;me-&gt;def points to
the previously saved one.

Calculating -------------------------------------
                          trunk        ours
vm2_poly_same_method     1.534M      2.025M i/s -      6.000M times in 3.910203s 2.962752s

Comparison:
             vm2_poly_same_method
                ours:   2025143.9 i/s
               trunk:   1534447.2 i/s - 1.32x  slower
</pre>
</div>
</content>
</entry>
<entry>
<title>Add a benchmark for opt_regexpmatch2</title>
<updated>2019-09-02T04:46:33+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2019-09-02T04:46:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ff462bc6c3d88bab9df4c8d17b420f21223984c2'/>
<id>ff462bc6c3d88bab9df4c8d17b420f21223984c2</id>
<content type='text'>
vm2_regexp was for opt_regexpmatch1.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
vm2_regexp was for opt_regexpmatch1.
</pre>
</div>
</content>
</entry>
<entry>
<title>Close created files [ci skip]</title>
<updated>2019-08-10T02:26:23+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2019-08-10T02:26:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=07e42e88d9f2b7756dde0a2377990ebf3c5e1973'/>
<id>07e42e88d9f2b7756dde0a2377990ebf3c5e1973</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
