From: "Eregon (Benoit Daloze) via ruby-core" Date: 2023-04-12T21:14:51+00:00 Subject: [ruby-core:113201] [Ruby master Feature#19538] Performance warnings Issue #19538 has been updated by Eregon (Benoit Daloze). #19573 is an alternative way to track singleton class creation, and @jeremyevans0 posted numbers for the cost of singleton classes in https://bugs.ruby-lang.org/issues/19573#note-3. I think a performance warning is more convenient to track singleton class creation, rather than `Class#singleton_inherited`, but I'm not against it. Performance warnings are easier to optimize for the "not enabled" case than avoiding the extra calls to `Class#singleton_inherited`, because those still need a method lookup to figure out it's the default empty `singleton_inherited` and skip the call. ---------------------------------------- Feature #19538: Performance warnings https://bugs.ruby-lang.org/issues/19538#change-102744 * Author: byroot (Jean Boussier) * Status: Open * Priority: Normal ---------------------------------------- Suggested by @Eregon. There are program behaviors that are supported, but that we know aren't good for performance, however it's hard for users to know about them. Now that we have warning categories, we could add a `:performance` category to allow the VM to emit warning in some situations. The category would be disabled by default, and users interested in optimizing their program could turn it on in development. ```ruby Warning[:performance] = true ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/