[#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@...

SXNzdWUgIzE3MTI5IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IHlhaG9uZGEgKFlhc3VvIEhvbmRhKS4N

9 messages 2020/08/26

[ruby-core:99595] [Ruby master Feature#17055] Allow suppressing uninitialized instance variable and method redefined verbose mode warnings

From: eregontp@...
Date: 2020-08-15 10:54:17 UTC
List: ruby-core #99595
Issue #17055 has been updated by Eregon (Benoit Daloze).


I ran the measurements on both CRuby master and 2.6.6, with `sqlite3` for c=
onvenience.
I see smaller differences, but also my results are about 6 times faster.
It's still a larger difference than I expect so I'll try to dig deeper.

Which version did you run with? Are you sure it's a build with default opti=
mizations?

Ruby master
```
$ ruby -v
ruby 2.8.0dev (2020-08-15T05:17:02Z master d75433ae19) [x86_64-linux]
$ gem i sequel benchmark-ips sqlite3
```

```
$ ruby bench_sequel_ivar.rb regular noplugin
Warming up --------------------------------------
  Retrieve 1000 rows    52.000  i/100ms
Calculating -------------------------------------
  Retrieve 1000 rows    523.676  (=B1 0.8%) i/s -      2.652k in   5.064474s

$ ruby bench_sequel_ivar.rb eager_initialize noplugin
Warming up --------------------------------------
  Retrieve 1000 rows    41.000  i/100ms
Calculating -------------------------------------
  Retrieve 1000 rows    419.425  (=B1 0.2%) i/s -      2.132k in   5.083185s
```
419.425 / 523.676 =3D 0.80, 20% slower

```
$ gem i activemodel
$ ruby bench_sequel_ivar.rb regular plugin
Warming up --------------------------------------
  Retrieve 1000 rows    43.000  i/100ms
Calculating -------------------------------------
  Retrieve 1000 rows    435.382  (=B1 0.5%) i/s -      2.193k in   5.037051s

$ ruby bench_sequel_ivar.rb eager_initialize plugin
Warming up --------------------------------------
  Retrieve 1000 rows    29.000  i/100ms
Calculating -------------------------------------
  Retrieve 1000 rows    292.735  (=B1 0.3%) i/s -      1.479k in   5.052414s
```
292.735 / 435.382 =3D 0.67, 33% slower
```
Ruby 2.6
$ ruby -v
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]
```

```
$ ruby bench_sequel_ivar.rb regular noplugin
Warming up --------------------------------------
  Retrieve 1000 rows    49.000  i/100ms
Calculating -------------------------------------
  Retrieve 1000 rows    491.918  (=B1 0.4%) i/s -      2.499k in   5.080182s

$ ruby bench_sequel_ivar.rb eager_initialize noplugin
Warming up --------------------------------------
  Retrieve 1000 rows    40.000  i/100ms
Calculating -------------------------------------
  Retrieve 1000 rows    396.391  (=B1 1.3%) i/s -      2.000k in   5.046391s
```
396.391 / 491.918 =3D 0.81, 19% slower
```
$ gem i activemodel
$ ruby bench_sequel_ivar.rb regular plugin
Warming up --------------------------------------
  Retrieve 1000 rows    44.000  i/100ms
Calculating -------------------------------------
  Retrieve 1000 rows    443.197  (=B1 0.2%) i/s -      2.244k in   5.063244s

$ ruby bench_sequel_ivar.rb eager_initialize plugin
Warming up --------------------------------------
  Retrieve 1000 rows    27.000  i/100ms
Calculating -------------------------------------
  Retrieve 1000 rows    273.062  (=B1 0.4%) i/s -      1.377k in   5.042868s
```
273.062 / 443.197 =3D 0.62, 38% slower


----------------------------------------
Feature #17055: Allow suppressing uninitialized instance variable and metho=
d redefined verbose mode warnings
https://bugs.ruby-lang.org/issues/17055#change-87073

* Author: jeremyevans0 (Jeremy Evans)
* Status: Open
* Priority: Normal
----------------------------------------
These two verbose mode warnings are both fairly common and have good reason=
s why you would not want to warn about them in specific cases.  Not initial=
izing instance variables to nil can be much better for performance, and red=
efining methods without removing the method first is the only safe approach=
 in multi-threaded code.

There are reasons that you may want to issue verbose warnings by default in=
 these cases.  For uninitialized instance variables, it helps catch typos. =
For method redefinition, it could alert you that a method already exists wh=
en you didn't expect it to, such as when a file is loaded multiple times wh=
en it should only be loaded once.

I propose we keep the default behavior the same, but offer the ability to o=
pt-out of these warnings by defining methods.  For uninitialized instance v=
ariables in verbose mode, I propose we call `expected_uninitialized_instanc=
e_variable?(iv)` on the object.  If this method doesn't exist or returns fa=
lse/nil, we issue the warning.  If the method exists and returns true, we s=
uppress the warning.  Similarly, for redefined methods, we call `expected_r=
edefined_method?(method_name)` on the class or module.  If the method doesn=
't exist or returns false/nil, we issue the warning.  If the method exists =
and returns true, we suppress the warning.

This approach allows high performance code (uninitialized instance variable=
s) and safe code (redefining methods without removing) to work without verb=
ose mode warnings.

I have implemented this support in a pull request: https://github.com/ruby/=
ruby/pull/3371

---Files--------------------------------
t.rb (5.59 KB)


-- =

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

Unsubscribe: <mailto:[email protected]?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread