I am using Views to fetch the 3 fields of a specific entity. However, this leads to the view to make a full load of the entity and all the images included in it, even though they are not displayed. This leads to loading 20 images per entity instead of 1!. How can I hook into the process and modify this. I tried almost all view's and entity's hooks but nothing seems to have an effect. Any ideas?
1 Answer
Are these custom entities or from a module? If they are custom you could try to override the 'query' or 'load' function in the entity controller class (defined in hook_entity_info() ). If it is from a contributed module, there isn't anything you can do without altering the module code.
Also please note that the actual images are only loaded when the browser requests them over http via an tag, the entity loads the fields over SQL. Agreed, this creates some overhead. But I guess you would hardly notice the difference when a few fields less are loaded.
-
the problem that for all these files file_load() is called. This results into 160ms overhead, which is quite important. Commented Jan 13, 2015 at 14:34
-
Ok, that is more then I expected, but it is embedded very deep in the entity system as most modules expect to have all associated data available. Commented Jan 13, 2015 at 16:01
-
I saw this issue where they pretty much verify what you are saying drupal.org/node/2028337 Commented Jan 14, 2015 at 8:27