summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-21 02:23:32 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-21 02:23:32 +0000
commite539565d9a69d9a355e747d016228926467348ab (patch)
treee36c93d5714302559ed1c2729a0979c7afcecd91
parent8bb93fc8ae53a541be4aa0c3223f1e505b913386 (diff)
* array.c: use rb_equal_opt() for performance improvement.
[ruby-core:64954] [Feature #10227] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--array.c8
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index baa44c9..5ccf00f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Sep 20 03:46:58 2014 Masaki Matsushita <glass.saga@gmail.com>
+
+ * array.c: use rb_equal_opt() for performance improvement.
+ [ruby-core:64954] [Feature #10227]
+
Sun Sep 21 11:16:56 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (rbtime2vtdate, vtdate2rbtime): fix
diff --git a/array.c b/array.c
index 6b551db..4775472 100644
--- a/array.c
+++ b/array.c
@@ -3846,9 +3846,15 @@ VALUE
rb_ary_includes(VALUE ary, VALUE item)
{
long i;
+ VALUE e;
for (i=0; i<RARRAY_LEN(ary); i++) {
- if (rb_equal(RARRAY_AREF(ary, i), item)) {
+ e = RARRAY_AREF(ary, i);
+ switch (rb_equal_opt(e, item)) {
+ case Qundef:
+ if (rb_equal(e, item)) return Qtrue;
+ break;
+ case Qtrue:
return Qtrue;
}
}