summaryrefslogtreecommitdiff
path: root/ChangeLog
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-12 02:00:41 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-12 02:00:41 +0000
commitcee7f6911bf4e5e3b4874243e8fe3e2eb351f194 (patch)
treefa99e0e95d574f87c2c9a6e02c37bf6039f304e3 /ChangeLog
parent4a59524099fe7932430be19a8c5eb837a93e7594 (diff)
io.c: avoid kwarg parsing in C API
* benchmark/bm_io_nonblock_noex2.rb: new benchmark based on bm_io_nonblock_noex.rb * io.c (io_read_nonblock): move documentation to prelude.rb (io_write_nonblock): ditto (Init_io): private, internal methods for prelude.rb use only * prelude.rb (IO#read_nonblock): wrapper + documentation (IO#write_nonblock): ditto [ruby-core:71439] [Feature #11339] rb_scan_args and hash lookups for kwargs in the C API are clumsy and slow. Instead of improving the C API for performance, use Ruby instead :) Implement IO#read_nonblock and IO#write_nonblock in prelude.rb to avoid argument parsing via rb_scan_args and hash lookups. This speeds up IO#write_nonblock and IO#read_nonblock benchmarks in both cases, including the original non-idiomatic case where the `exception: false' hash is pre-allocated to avoid GC pressure. Now, writing the kwargs in natural, idiomatic Ruby is fastest. I've added the noex2 benchmark to show this. 2015-11-12 01:41:12 +0000 target 0: a (ruby 2.3.0dev (2015-11-11 trunk 52540) [x86_64-linux]) target 1: b (ruby 2.3.0dev (2015-11-11 avoid-kwarg-capi 52540) ----------------------------------------------------------- benchmark results: minimum results in each 10 measurements. Execution time (sec) name a b io_nonblock_noex 2.508 2.382 io_nonblock_noex2 2.950 1.882 Speedup ratio: compare with the result of `a' (greater is better) name b io_nonblock_noex 1.053 io_nonblock_noex2 1.567 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ChangeLog')
-rw-r--r--ChangeLog11
1 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b313e1e164..6ecd1dc9cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Thu Nov 12 10:53:41 2015 Eric Wong <e@80x24.org>
+
+ * benchmark/bm_io_nonblock_noex2.rb: new benchmark based
+ on bm_io_nonblock_noex.rb
+ * io.c (io_read_nonblock): move documentation to prelude.rb
+ (io_write_nonblock): ditto
+ (Init_io): private, internal methods for prelude.rb use only
+ * prelude.rb (IO#read_nonblock): wrapper + documentation
+ (IO#write_nonblock): ditto
+ [ruby-core:71439] [Feature #11339]
+
Wed Nov 11 18:30:28 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sprintf.c (rb_str_format): look up the key, then get default