[ruby-core:116645] [Ruby master Misc#20222] Dedup-ing clarification
From:
"byroot (Jean Boussier) via ruby-core" <ruby-core@...>
Date:
2024-02-09 11:25:46 UTC
List:
ruby-core #116645
Issue #20222 has been updated by byroot (Jean Boussier).
For the full context see [Feature #8992].
It's true that it's a bit questionable that it's treated as an optimization, but realistically speaking no-one is compiling code without optimizations, it's just for MRI developers.
Also `erubi` and a few other projects heavily rely on this for performance.
----------------------------------------
Misc #20222: Dedup-ing clarification
https://bugs.ruby-lang.org/issues/20222#change-106654
* Author: kddnewton (Kevin Newton)
* Status: Open
* Priority: Normal
----------------------------------------
``` ruby
source = %q{"foo".freeze.equal?("foo".freeze)}
RubyVM::InstructionSequence.compile(source).eval # => true
RubyVM::InstructionSequence.compile_option = false
RubyVM::InstructionSequence.compile(source).eval # => false
```
`"foo".freeze` uses `opt_str_freeze` when optimizations are turned on, which also deduplicates. This means this code has different behavior depending on if optimizations are turned on or off.
To be clear, I'm not saying whether or not this is a problem. I'm asking if this is desired behavior?
--
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/