mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Optimize instructions when creating an array just to call include?
(#12123)
* Add opt_duparray_send insn to skip the allocation on `#include?` If the method isn't going to modify the array we don't need to copy it. This avoids the allocation / array copy for things like `[:a, :b].include?(x)`. This adds a BOP for include? and tracks redefinition for it on Array. Co-authored-by: Andrew Novoselac <andrew.novoselac@shopify.com> * YJIT: Implement opt_duparray_send include_p Co-authored-by: Andrew Novoselac <andrew.novoselac@shopify.com> * Update opt_newarray_send to support simple forms of include?(arg) Similar to opt_duparray_send but for non-static arrays. * YJIT: Implement opt_newarray_send include_p --------- Co-authored-by: Andrew Novoselac <andrew.novoselac@shopify.com>
This commit is contained in:
parent
c1dcd1d496
commit
1dd40ec18a
Notes:
git
2024-11-26 19:31:33 +00:00
Merged-By: maximecb <maximecb@ruby-lang.org>
14 changed files with 573 additions and 156 deletions
|
@ -61,6 +61,7 @@ firstline, predefined = __LINE__+1, %[\
|
|||
path
|
||||
pack
|
||||
buffer
|
||||
include?
|
||||
|
||||
_ UScore
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue