Working with https://www.drupal.org/project/quiz_item_analysis I noticed a lot of node_load() calls that were duplicate.

Here's a quick fix to avoid the db calls for the same question nodes.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

Project: Quiz item analysis » Quiz
Version: 7.x-1.x-dev » 7.x-6.x-dev
Component: Code » Code - Quiz core
joelpittet’s picture

FileSize
1.33 KB
joelpittet’s picture

Status: Active » Needs review
joelpittet’s picture

Version: 7.x-6.x-dev » 7.x-5.x-dev
joelpittet’s picture

Forgot to use static for the call repeats.

djdevin’s picture

I thought node_load() already had a static cache? Are you seeing improved performance?

joelpittet’s picture

It wouldn’t run without it and I had upped the timeout too 160 s and memory was at 512M already.

I thought it did too but that change helped a lot!

joseph.olstad’s picture

Status: Needs review » Reviewed & tested by the community

Nice patch @Joelpittet
using this patch in production, works as advertised.