Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #3808. defined? poor performance
As much as I dislike this fix it is exactly how MRI handles colon2 defined?. The current impl is to basically call defined? on lhs of a colon2 and if it is not nil then build lhs for realsies and then use that live value to test the rhs. This new mechanism is about 2x as fast as const_given? now and about 150x faster than it was. Ultimately, we need much cleaner mechanisms for how we access constants or chains of constants so we can control: access Object, public/private, autoload, and const_missing. All of these are dimensions of access which sometimes defined? wants and sometimes regular searches want.