EntityBCDecorator chooses to call __get() if called via __isset().

This is in general a very bad idea as a lot of code relies on isset() being fast on Arrays or object properties.

In particular this is relevant to Twig, which needs a way to fast check if a property exists or not.

For 12 nodes the difference is around 0.9ms, which are unnecessary.

See: http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?symbol=Drupal%5CCor... for an example.

I think it at least could call the isset() function of EntityNG, though I do not much about EntityNG, yet to know if that would be feasible.

Comments

pancho’s picture

Thanks for reporting, but citing Berdir in #1917378-2: Improve the comments on EntityBCDecorator, we won't bother with improving what will go away until D8 release anyway:

The class is a temporary hack until we converted everything to NG and then it will be removed again. I really don't think that we need to worry about this?

Leaving it open though, because we never know if we get everything 100% converted.

berdir’s picture

Status: Active » Closed (duplicate)

EntityBCDecorator is gone.

fabianx’s picture

Yes!!!