<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/ruby.git/benchmark, branch ruby_2_2</title>
<subtitle>github.com: ruby/ruby.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/'/>
<entry>
<title>merge revision(s) 50084: [Backport #10999]</title>
<updated>2015-05-19T18:11:15+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2015-05-19T18:11:15+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=3f1fc07e0533b1c27817828843513964f1b8b67d'/>
<id>3f1fc07e0533b1c27817828843513964f1b8b67d</id>
<content type='text'>
	* benchmark/bm_hash_aref_flo.rb: make more realistic data.
	  [ruby-core:68632] [[Bug #10999]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@50547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	* benchmark/bm_hash_aref_flo.rb: make more realistic data.
	  [ruby-core:68632] [[Bug #10999]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@50547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 49376,49387,49389: [Backport #10761]</title>
<updated>2015-02-05T16:05:10+00:00</updated>
<author>
<name>naruse</name>
<email>naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2015-02-05T16:05:10+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=665f7a2ff1ce1c73118eb06e13a35d480ab89c3c'/>
<id>665f7a2ff1ce1c73118eb06e13a35d480ab89c3c</id>
<content type='text'>
	* st.c (st_numhash): mix float value for flonum

	* hash.c (rb_any_hash): ditto

	* benchmark/bm_hash_aref_flo.rb: new benchmark

	* benchmark/bm_hash_ident_flo.rb: ditto
	  [Bug #10761]

	* benchmark/bm_marshal_dump_flo.rb: new benchmark for [Bug #10761]

	* marshal.c (w_object, marshal_dump): use indetity tables for
	  arbitrary VALUE keys, because of performance of FLONUM.
	  [Bug #10761]

	* marshal.c (obj_alloc_by_klass, marshal_load): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	* st.c (st_numhash): mix float value for flonum

	* hash.c (rb_any_hash): ditto

	* benchmark/bm_hash_aref_flo.rb: new benchmark

	* benchmark/bm_hash_ident_flo.rb: ditto
	  [Bug #10761]

	* benchmark/bm_marshal_dump_flo.rb: new benchmark for [Bug #10761]

	* marshal.c (w_object, marshal_dump): use indetity tables for
	  arbitrary VALUE keys, because of performance of FLONUM.
	  [Bug #10761]

	* marshal.c (obj_alloc_by_klass, marshal_load): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>struct: avoid all O(n) behavior on access</title>
<updated>2014-12-09T15:43:49+00:00</updated>
<author>
<name>normal</name>
<email>normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2014-12-09T15:43:49+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=65651b34b1b5c2ef556ed44d5ebbd98838cfe8e6'/>
<id>65651b34b1b5c2ef556ed44d5ebbd98838cfe8e6</id>
<content type='text'>
This avoids O(n) on lookups with structs over 10 members.
This also avoids O(n) behavior on all assignments on Struct members.
Members 0..9 still use existing C methods to read in O(1) time

Benchmark results:

vm2_struct_big_aref_hi*	1.305
vm2_struct_big_aref_lo*	1.157
vm2_struct_big_aset*	3.306
vm2_struct_small_aref*	1.015
vm2_struct_small_aset*	3.273

Note: I chose use loading instructions from an array instead of writing
directly to linked-lists in compile.c for ease-of-maintainability.  We
may move the method definitions to prelude.rb-like files in the future.

I have also tested this patch with the following patch to disable
the C ref_func methods and ensured the test suite and rubyspec works

	--- a/struct.c
	+++ b/struct.c
	@@ -209,7 +209,7 @@ setup_struct(VALUE nstr, VALUE members)
		ID id = SYM2ID(ptr_members[i]);
		VALUE off = LONG2NUM(i);

	-	if (i &lt; N_REF_FUNC) {
	+	if (0 &amp;&amp; i &lt; N_REF_FUNC) {
		    rb_define_method_id(nstr, id, ref_func[i], 0);
		}
		else {

* iseq.c (rb_method_for_self_aref, rb_method_for_self_aset):
  new methods to generate bytecode for struct.c
  [Feature #10575]
* struct.c (rb_struct_ref, rb_struct_set): remove
  (define_aref_method, define_aset_method): new functions
  (setup_struct): use new functions
* test/ruby/test_struct.rb: add test for struct &gt;10 members
* benchmark/bm_vm2_struct_big_aref_hi.rb: new benchmark
* benchmark/bm_vm2_struct_big_aref_lo.rb: ditto
* benchmark/bm_vm2_struct_big_aset.rb: ditto
* benchmark/bm_vm2_struct_small_aref.rb: ditto
* benchmark/bm_vm2_struct_small_aset.rb: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This avoids O(n) on lookups with structs over 10 members.
This also avoids O(n) behavior on all assignments on Struct members.
Members 0..9 still use existing C methods to read in O(1) time

Benchmark results:

vm2_struct_big_aref_hi*	1.305
vm2_struct_big_aref_lo*	1.157
vm2_struct_big_aset*	3.306
vm2_struct_small_aref*	1.015
vm2_struct_small_aset*	3.273

Note: I chose use loading instructions from an array instead of writing
directly to linked-lists in compile.c for ease-of-maintainability.  We
may move the method definitions to prelude.rb-like files in the future.

I have also tested this patch with the following patch to disable
the C ref_func methods and ensured the test suite and rubyspec works

	--- a/struct.c
	+++ b/struct.c
	@@ -209,7 +209,7 @@ setup_struct(VALUE nstr, VALUE members)
		ID id = SYM2ID(ptr_members[i]);
		VALUE off = LONG2NUM(i);

	-	if (i &lt; N_REF_FUNC) {
	+	if (0 &amp;&amp; i &lt; N_REF_FUNC) {
		    rb_define_method_id(nstr, id, ref_func[i], 0);
		}
		else {

* iseq.c (rb_method_for_self_aref, rb_method_for_self_aset):
  new methods to generate bytecode for struct.c
  [Feature #10575]
* struct.c (rb_struct_ref, rb_struct_set): remove
  (define_aref_method, define_aset_method): new functions
  (setup_struct): use new functions
* test/ruby/test_struct.rb: add test for struct &gt;10 members
* benchmark/bm_vm2_struct_big_aref_hi.rb: new benchmark
* benchmark/bm_vm2_struct_big_aref_lo.rb: ditto
* benchmark/bm_vm2_struct_big_aset.rb: ditto
* benchmark/bm_vm2_struct_small_aref.rb: ditto
* benchmark/bm_vm2_struct_small_aset.rb: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>benchmark/bm_hash_aref_sym*.rb: force static symbols</title>
<updated>2014-10-09T03:44:12+00:00</updated>
<author>
<name>normal</name>
<email>normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2014-10-09T03:44:12+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=098b0ba572d624acdc2af1925db7feda4b72881e'/>
<id>098b0ba572d624acdc2af1925db7feda4b72881e</id>
<content type='text'>
Dynamic symbols hash more slowly because they need extra method
dispatch in rb_any_hash.  I am not sure if dynamic symbols are
a realistic use case as hash keys, so this commit only
restores performance when comparing against versions of Ruby
which lack dsyms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Dynamic symbols hash more slowly because they need extra method
dispatch in rb_any_hash.  I am not sure if dynamic symbols are
a realistic use case as hash keys, so this commit only
restores performance when comparing against versions of Ruby
which lack dsyms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>bm_app_aobench.rb: update links  [ci skip]</title>
<updated>2014-09-16T10:18:53+00:00</updated>
<author>
<name>nobu</name>
<email>nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2014-09-16T10:18:53+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=29329d55ec0463be1c30506714f2b0020d89ecab'/>
<id>29329d55ec0463be1c30506714f2b0020d89ecab</id>
<content type='text'>
* benchmark/bm_app_aobench.rb: update outdated links to the
  original program.  [ruby-dev:48550] [Feature #10247]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* benchmark/bm_app_aobench.rb: update outdated links to the
  original program.  [ruby-dev:48550] [Feature #10247]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>benchmark/bm_app_aobench.rb: spelling fix [ci skip]</title>
<updated>2014-09-15T07:17:37+00:00</updated>
<author>
<name>normal</name>
<email>normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2014-09-15T07:17:37+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=667d502adbb9cfa6aa9fcdfbd9e95e251c8f0ba7'/>
<id>667d502adbb9cfa6aa9fcdfbd9e95e251c8f0ba7</id>
<content type='text'>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>proc.c (rb_proc_alloc): inline and move to vm.c</title>
<updated>2014-09-12T20:57:45+00:00</updated>
<author>
<name>normal</name>
<email>normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2014-09-12T20:57:45+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=ec475ab32d7ba876c1ce96f9ce6704d85be6a3ac'/>
<id>ec475ab32d7ba876c1ce96f9ce6704d85be6a3ac</id>
<content type='text'>
* proc.c (rb_proc_alloc): inline and move to vm.c
  (rb_proc_wrap): new wrapper function used by rb_proc_alloc
  (proc_dup): simplify alloc + copy + wrap operation
  [ruby-core:64994]

* vm.c (rb_proc_alloc): new inline function
  (rb_vm_make_proc): call rb_proc_alloc

* vm_core.h: remove rb_proc_alloc, add rb_proc_wrap

* benchmark/bm_vm2_newlambda.rb: short test to show difference

First we allocate and populate an rb_proc_t struct inline to avoid
unnecessary zeroing of the large struct.  Inlining speeds up callers as
this takes many parameters to ensure correctness.  We then call the new
rb_proc_wrap function to create the object.

rb_proc_wrap - wraps a rb_proc_t pointer as a Ruby object, but
we only use it inside rb_proc_alloc.  We must call this before
the compiler may clobber VALUE parameters passed to rb_proc_alloc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* proc.c (rb_proc_alloc): inline and move to vm.c
  (rb_proc_wrap): new wrapper function used by rb_proc_alloc
  (proc_dup): simplify alloc + copy + wrap operation
  [ruby-core:64994]

* vm.c (rb_proc_alloc): new inline function
  (rb_vm_make_proc): call rb_proc_alloc

* vm_core.h: remove rb_proc_alloc, add rb_proc_wrap

* benchmark/bm_vm2_newlambda.rb: short test to show difference

First we allocate and populate an rb_proc_t struct inline to avoid
unnecessary zeroing of the large struct.  Inlining speeds up callers as
this takes many parameters to ensure correctness.  We then call the new
rb_proc_wrap function to create the object.

rb_proc_wrap - wraps a rb_proc_t pointer as a Ruby object, but
we only use it inside rb_proc_alloc.  We must call this before
the compiler may clobber VALUE parameters passed to rb_proc_alloc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>* benchmark/bm_app_lc_fizzbuzz.rb: should skip output on benchmark.</title>
<updated>2014-09-08T07:08:56+00:00</updated>
<author>
<name>ko1</name>
<email>ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2014-09-08T07:08:56+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=2a0cca3c89f55912e7baea5137f550617e505c68'/>
<id>2a0cca3c89f55912e7baea5137f550617e505c68</id>
<content type='text'>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>* benchmark/bm_app_lc_fizzbuzz.rb: `answer.to_a' does not return</title>
<updated>2014-09-08T07:08:00+00:00</updated>
<author>
<name>ko1</name>
<email>ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2014-09-08T07:08:00+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=f5ac3ea6e7c75d744fcb8222675ff76f960a423a'/>
<id>f5ac3ea6e7c75d744fcb8222675ff76f960a423a</id>
<content type='text'>
  a string, but an array.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  a string, but an array.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>* benchmark/bm_app_lc_fizzbuzz.rb: added.</title>
<updated>2014-09-08T04:22:58+00:00</updated>
<author>
<name>ko1</name>
<email>ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2014-09-08T04:22:58+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=628dac10d38e46341cf3f76361c130c45123f4b1'/>
<id>628dac10d38e46341cf3f76361c130c45123f4b1</id>
<content type='text'>
  This program is described closely in "Understanding Computation"
  chapter 6 by Tom Stuart. &lt;http://computationbook.com/&gt;
  Japanese translation will be published soon.
  &lt;http://www.oreilly.co.jp/books/9784873116976/&gt;



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  This program is described closely in "Understanding Computation"
  chapter 6 by Tom Stuart. &lt;http://computationbook.com/&gt;
  Japanese translation will be published soon.
  &lt;http://www.oreilly.co.jp/books/9784873116976/&gt;



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
</feed>
