ipjohnson / Grace

Grace is a feature rich dependency injection container library
MIT License
336 stars 33 forks source link

Removing some double-casting from ImmutableArray. #249

Closed uygary closed 4 years ago

uygary commented 4 years ago

As far as I'm aware, is uses isinst opcode under the hood, which only differs from the castclass opcode that explicit cast uses when the type check fails. That would mean the type cast is already performed, so there's no need to cast the object again. We can simply get a reference and use it with the obj is Foo foo pattern.

I realize this is really nitpicking even if I'm correct about the behavior, but I was just reading through the library to get a basic grip of how things work, and I figured I'd send a useless PR to squeeze out 1 more cycle from the CPU.

ipjohnson commented 4 years ago

You are correct good catch.

ipjohnson commented 4 years ago

This is released as a beta now