[#99426] [Ruby master Bug#17098] Float#negative? reports negative zero as not negative — chris@...

Issue #17098 has been reported by chrisseaton (Chris Seaton).

12 messages 2020/08/01

[#99449] [Ruby master Bug#17100] Ractor: a proposal for new concurrent abstraction without thread-safety issues — ko1@...

Issue #17100 has been reported by ko1 (Koichi Sasada).

41 messages 2020/08/03

[#99474] [Ruby master Feature#17103] Add a :since option to ObjectSpace.dump_all — jean.boussier@...

Issue #17103 has been reported by byroot (Jean Boussier).

9 messages 2020/08/04

[#99485] [Ruby master Misc#17104] Why are interpolated string literals frozen? — bughitgithub@...

Issue #17104 has been reported by bughit (bug hit).

23 messages 2020/08/05

[#99499] [Ruby master Bug#17105] A single `return` can return to two different places in a proc inside a lambda inside a method — eregontp@...

Issue #17105 has been reported by Eregon (Benoit Daloze).

10 messages 2020/08/06

[#99582] [Ruby master Feature#17122] Add category to Warning#warn — eileencodes@...

Issue #17122 has been reported by eileencodes (Eileen Uchitelle).

20 messages 2020/08/13

[#99700] [Ruby master Bug#17129] bundle install `eventmachine` and `sassc` fails since 914b2208ab3eddec478cdc3e079e6c30d0f0892c — yasuo.honda@...

Issue #17129 has been reported by yahonda (Yasuo Honda).

9 messages 2020/08/26

[ruby-core:99706] [Ruby master Bug#17030] Enumerable#grep{_v} should be optimized for Regexp

From: fatkodima123@...
Date: 2020-08-26 17:01:25 UTC
List: ruby-core #99706
Issue #17030 has been updated by fatkodima (Dima Fatko).


marcandre (Marc-Andre Lafortune) wrote in #note-12:
> Maybe it would be best to start a different thread as none of these proposals have a relation to `grep{_v}` without block not being optimized.

I have already implemented a patch to make `grep{_v}` faster and right before submitting the `Create Pull Request` button, I realized (with the help of scivola20's comment), that this case can be generalized. Because we already have, at least, `Enumerable#{all?,any?,none?}` and many future methods to be added (like `grep`), which can benefit from this generalized solution. 


> This is Ruby, so I can think of some corner cases where things like `const_get(:Regexp).last_match` would be impacted (in theory), what other limitations would this have?
> 

`case-when`? 

> Couldn't static analysis of the code determine in most cases if match data need be generated or not?
> 

In many cases, probably yes, but again, `case-when`.

----------------------------------------
Bug #17030: Enumerable#grep{_v} should be optimized for Regexp
https://bugs.ruby-lang.org/issues/17030#change-87197

* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
Currently:

```ruby
array.select { |e| e.match?(REGEXP) }

# about 3x faster and 6x more memory efficient than
array.grep(REGEXP)
```

This is because `grep` calls `Regexp#===` which creates useless `MatchData`



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread