refstudycentre/rsc_taglinks

Performance of rsc_taglinks_node_presave

Closed this issue · 2 comments

The rsc_taglinks_node_presave function should be made much faster, because it gets called for every node when we do any type of batch update on nodes.

One of the culprits is that it calls field_info_fields. It is cached per page request, but we don't necessarily process all nodes in one page request.

With commit 11862be the time to load and save 1000 nodes with a drush script on my laptop is:

real 1m10.725s
user 0m35.016s
sys  0m2.148s

According to the PHP manual, default execution time is 30s of user time on Unix, so we could do no more than 856 nodes per page request. Assuming that a typical web server is faster then my HP Probook 6560b, 500 nodes per page request should be a safe limit.

This means for a site with 7000 nodes (about the number of library articles currently on CL), we need a batch job with 14 iterations. 😎

I did what I could, although I couldn't avoid calling field_info_fields. Closing for now.