From: eregontp@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:95653] [Ruby master Feature#16289] Reduce duplicated warnings for the change of Ruby 3 keyword arguments
Date: Sat, 02 Nov 2019 12:56:05 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-82441.20191102125605.a609b9811e665b4f@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-16289.20191101032931@ruby-lang.org
Issue #16289 has been updated by Eregon (Benoit Daloze).
What's the performance with this patch for a call site that would warn?
```
$ chruby ruby-2.7.0-preview2
$ ruby -rbenchmark/ips -e 'def m(**kw); end; h = {a: 1}; Benchmark.ips { |x| x.report { m(h) } }' 2>/dev/null
Warming up --------------------------------------
46.040k i/100ms
Calculating -------------------------------------
504.460k (± 7.0%) i/s - 2.532M in 5.050515s
$ chruby 2.6.2
$ ruby -rbenchmark/ips -e 'def m(**kw); end; h = {a: 1}; Benchmark.ips { |x| x.report { m(h) } }'
Warming up --------------------------------------
322.637k i/100ms
Calculating -------------------------------------
5.925M (± 8.8%) i/s - 29.683M in 5.055851s
```
----------------------------------------
Feature #16289: Reduce duplicated warnings for the change of Ruby 3 keyword arguments
https://bugs.ruby-lang.org/issues/16289#change-82441
* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
## Problem
Currently, the interpreter emits 200 lines of warnings against the following program.
```ruby
def foo(**opt); end
100.times { foo({kw:1}) }
```
```
$ ./miniruby -e 'def foo(**opt); end; 100.times { foo({kw:1}) }'
-e:1: warning: The last argument is used as the keyword parameter
-e:1: warning: for `foo' defined here
-e:1: warning: The last argument is used as the keyword parameter
-e:1: warning: for `foo' defined here
-e:1: warning: The last argument is used as the keyword parameter
-e:1: warning: for `foo' defined here
...
```
In theory, the warnings are not harmful because they don't stop or interfere the execution. But in practice, I'm afraid if they are annoying because they flush all console logs away.
I think that the warning is not needed if the call is already warned.
## Proposal
How about limiting the count of warnings to at most once for each pair of caller and callee?
I've created [a pull request](https://github.com/ruby/ruby/pull/2458). It records all pairs of caller position and callee iseq when emitting a warning, and suppress the warning if the same pair of caller and callee is already warned.
What do you think?
--
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>
next prev parent reply other threads:[~2019-11-02 12:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-16289.20191101032931@ruby-lang.org>
2019-11-01 3:29 ` [ruby-core:95627] [Ruby master Feature#16289] Reduce duplicated warnings for the change of Ruby 3 keyword arguments mame
2019-11-01 4:43 ` [ruby-core:95630] " Eric Wong
2019-11-01 4:38 ` [ruby-core:95629] " ruby-core
2019-11-01 7:03 ` [ruby-core:95631] " nobu
2019-11-01 13:26 ` [ruby-core:95634] " mame
2019-11-02 8:00 ` [ruby-core:95651] " mame
2019-11-02 12:56 ` eregontp [this message]
2019-11-02 15:47 ` [ruby-core:95655] " ruby-core
2019-11-04 16:41 ` [ruby-core:95670] " daniel
2019-11-05 9:35 ` [ruby-core:95692] " shevegen
2019-11-10 11:24 ` [ruby-core:95775] " eregontp
2019-11-10 22:20 ` [ruby-core:95780] " sam.saffron
2019-11-11 1:00 ` [ruby-core:95783] " sam.saffron
2019-11-29 8:12 ` [ruby-core:96025] " mame
2019-12-23 7:37 ` [ruby-core:96418] " ruby-core
2019-12-23 11:49 ` [ruby-core:96425] " mame
2019-12-23 12:51 ` [ruby-core:96427] " eregontp
2019-12-23 17:47 ` [ruby-core:96439] " merch-redmine
2019-12-23 21:49 ` [ruby-core:96441] " ruby-core
2019-12-24 7:06 ` [ruby-core:96452] " mame
2019-12-24 7:10 ` [ruby-core:96453] " matz
2019-12-24 7:23 ` [ruby-core:96455] " mame
2019-12-24 7:34 ` [ruby-core:96456] " mame
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-82441.20191102125605.a609b9811e665b4f@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).