All entity type attributes loaded in Magento\Eav\Model\Config (Magento 2.2.2)
I just ran into a problem: Why does Magento load all entity-type attributes in the Model
I am facing a situation with many product-attributes (round about 20,000) and sets (almost 1,000) and the shop became very slow. Some debugging made clear, that in the named class (Magento\Eav\Model\Config.php) all entity-type attributes are loaded and stored in an array, the set is ignored. This makes the site really slow.
On a product page, the function getEntityAttributes of the Config model is called twice. Once with the product object, which leads into loading the correct attribute set. The second time it is loaded just for the product entity type. That makes Magento load all product attributes and saves it into an array, which is very slow. The function getAttributes - for example - calls the function getEntityAttributes just by entitytype.