Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Product reference
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 Oct 2015 at 21:48 UTC
Updated:
2 Apr 2016 at 22:14 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #2
joelpittetThis saved about 16ms on a product listing page. Depending on your setup you could save more;)
Comment #3
joelpittetActually this is nicer, saves nearly 100ms.
Not as quick of a fix
Comment #4
joelpittetComment #5
mglamanComment #6
mglamanGiving it a test run with CK2's Behat https://travis-ci.org/mglaman/commerce_kickstart/builds/97034950
Comment #7
mglamanThis looks good to me. Tests pass on CK2, manually reviewed and found no issues. Moving calls out of loops that don't need to be is always a win.
Comment #9
rszrama commentedIs this two patches combined in one? Didn't see an explanation for the switch in wrapper usage - and it's kinda funky to see something like this:
Comment #10
joelpittet@rszrama that is funky, it was to avoid other changes (minimizing the diff of name changes). Don't think it's two patches combined all relate to the performance of that one super large function.
Comment #11
rszrama commentedOk, I'll review. I was originally under the impression the real trick here was moving drupal_get_path() out of the foreach, but I see it's also these other function calls, including not invoking the wrapper in the foreach. I'll probably clean up the variable names before committing.
Comment #12
joelpittet@rszrama I'll look at this again, maybe I can unfuddle the variable naming without too much hunk changes.
Comment #13
joelpittet@rszrama the big reason for getting the reference value early is to avoid the count() on the EMW value.
If you feel comfortable committing part and not the other then LMK and I'll split this issue.
Hopefully these changes make it easier to review and not so funky;)
Comment #14
mglamanCourtesy CK2 Behat test run https://travis-ci.org/mglaman/commerce_kickstart/builds/97526318
Comment #15
rszrama commentedOk, think I wrapped my head around all the changes. Two observations:
Patch attached.
Comment #16
joelpittet@rszrama cool, can you throw up an interdiff please?
Comment #17
mglamanAttached interdiff of #13 to #15
Comment #18
torgospizzaComment #19
torgospizzaC'mon testbot!
Comment #20
joelpittetThanks for the interdiff @mglaman I've went through and it looks good:) @rszrama it's RTBC from me but I'll let a sober second set of eyes on it.
Comment #21
smccabe commentedPatch looks good to me, only one tiny nitpick, this comment really only makes sense in the context of this patch, once this is committed, the comment seems unnecessary and slightly confusing, it's not like we explain the scope of every variable we set.
Comment #22
rszrama commentedCommitted.