https://issues.dlang.org/show_bug.cgi?id=18541
Jonathan M Davis <issues.dl...@jmdavisprog.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |issues.dl...@jmdavisprog.co | |m --- Comment #7 from Jonathan M Davis <issues.dl...@jmdavisprog.com> --- (In reply to Basile B. from comment #6) > (In reply to Steven Schveighoffer from comment #5) > > Note that == will shortcut and return true if the two instances are the same > > object. > > With someone yesterday we have verified that it's really not the case. In a > specific hotspot, using "==" instead of "is" made something running in 7 > minutes instead of 4 ! > > This is exactly why i opened this issue but unfortunately i understand now > that it's not applicable, we just take care to use "is". The very first thing in the implementation of the free function opEquals is if (lhs is rhs) return true; So, it most definitely shortcuts. Now, that doesn't mean that it's as efficient, since unless it's inlined, you're calling a function that isn't called if you use is directly, but the shortcut definitely happens. --