Looking at the code I noticed that there is room for improvement performance-wise. file_entity_entitycache_load() is not needed as it's job is done by file_entitycache_file_load(which is BTW wrongly named - it should be file_entity_entitycache_file_load. So I will provided a patch for that. The code has been added in https://www.drupal.org/project/file_entity/issues/2665960, check it for more info.

Comments

angel.h created an issue. See original summary.

angel.h’s picture

Status: Needs work » Needs review
StatusFileSize
new961 bytes

Here is the patch.

joseph.olstad’s picture

Seems to make sense, did you get any performance statistics results before and after to share?

What performance gain might we expect?

joseph.olstad’s picture

I just tested your patch, it seems to work fine. I did not do any profiling on it though, I don't have a test environment with xhprof handy at the moment.

NOTE: for additional performance improvements, please try out this patch as well
#2642764-34: Speed up via shortcutting token file_entity_file_load

joseph.olstad’s picture

joseph.olstad’s picture

joseph.olstad’s picture

Title: Performance issue » Performance fix - rename file_entitycache_file_load to file_entity_entitycache_file_load
Issue tags: +Performance
joseph.olstad’s picture

I tested this patch quite a bit, cannot find anything wrong with it. Passes all tests too.

joseph.olstad’s picture

Status: Needs review » Fixed

pushed to 7.x-2.x and 7.x-3.x
thanks @Angel

please review the other performance patch if you can.
#2642764-34: Speed up via shortcutting token file_entity_file_load

joseph.olstad’s picture

@Angel, did you actually do any performance profiling on this patch? before/after results?
would be nice to know, add some confidence.

angel.h’s picture

@joseph.olstad Yes, I did but only locally and yes it did show improvement but I did not record it. Today or tomorrow I'll deploy on live and since I have a jMeter recording of before, I'll let you know about the after! Also - thanks for the quick reaction.

joseph.olstad’s picture

Hi Angel.h, if you can also performance profile the other patch also that'd be great.
would be nice to know how much of a change these two patches bring.
here's the other
#2642764-34: Speed up via shortcutting token file_entity_file_load

angel.h’s picture

Assigned: angel.h » Unassigned

@joseph.olstad Just tested the before and after of https://www.drupal.org/files/issues/2018-04-28/file_entity-n2642764-34.p... on a very slow local site where the average load time on 3 pages was 19641 miliseconds and it went down to 13458 miliseconds - a gain of 6183 miliseconds!

joseph.olstad’s picture

Ok, this justifies cutting a release asap.

Thanks!

joseph.olstad’s picture

Ok, thanks, I just cut 7.x-2.21 and 7.x-3.0-beta7

If you can please help review the other pending performance patch, that'd be greatly appreciated.
#2642764-34: Speed up via shortcutting token file_entity_file_load

THANKS!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.