* NEWS: add Array#max, #min, and the optimization. [Feature #12172]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3c7c983300
commit
f8e2964065
@ -1,8 +1,12 @@
|
|||||||
|
Thu Mar 17 21:47:57 2016 Yusuke Endoh <mame@ruby-lang.org>
|
||||||
|
|
||||||
|
* NEWS: add Array#max, #min, and the optimization. [Feature #12172]
|
||||||
|
|
||||||
Thu Mar 17 21:45:02 2016 Yusuke Endoh <mame@ruby-lang.org>
|
Thu Mar 17 21:45:02 2016 Yusuke Endoh <mame@ruby-lang.org>
|
||||||
|
|
||||||
* compile.c (NODE_CALL): add optimization shortcut for Array#max/min.
|
* compile.c (NODE_CALL): add optimization shortcut for Array#max/min.
|
||||||
Now `[x, y].max` is optimized so that a temporal array object is not
|
Now `[x, y].max` is optimized so that a temporal array object is not
|
||||||
created in some condition.
|
created in some condition. [Feature #12172]
|
||||||
|
|
||||||
* insns.def (opt_newarray_max, opt_newarray_min): added.
|
* insns.def (opt_newarray_max, opt_newarray_min): added.
|
||||||
|
|
||||||
|
14
NEWS
14
NEWS
@ -16,6 +16,12 @@ with all sufficient information, see the ChangeLog file or Redmine
|
|||||||
|
|
||||||
=== Core classes updates (outstanding ones only)
|
=== Core classes updates (outstanding ones only)
|
||||||
|
|
||||||
|
* Array
|
||||||
|
* Array#max and Array#min. [Feature #12172]
|
||||||
|
This may cause a tiny incompatibility: if you redefine
|
||||||
|
Enumerable#max and call max to an Array, your redefinition will be
|
||||||
|
now ignored. You should also redefine Array#max.
|
||||||
|
|
||||||
* Dir
|
* Dir
|
||||||
|
|
||||||
* Dir.empty?. [Feature #10121]
|
* Dir.empty?. [Feature #10121]
|
||||||
@ -53,3 +59,11 @@ with all sufficient information, see the ChangeLog file or Redmine
|
|||||||
=== Supported platform changes
|
=== Supported platform changes
|
||||||
|
|
||||||
=== Implementation improvements
|
=== Implementation improvements
|
||||||
|
|
||||||
|
* In some condition, `[x, y].max` and `[x, y].min` are optimized
|
||||||
|
so that a temporal array is not created. The concrete condition is
|
||||||
|
an implementation detail: currently, the array literal must have no
|
||||||
|
splat, must have at least one expression but literal, the length must
|
||||||
|
be <= 0x100, and Array#max and min must not be redefined. It will work
|
||||||
|
in most casual and real-life use case where it is written with intent
|
||||||
|
to `Math.max(x, y)`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user