Closed (fixed)
Project:
Drupal core
Version:
8.5.x-dev
Component:
views.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
22 Aug 2017 at 12:46 UTC
Updated:
10 Sep 2017 at 21:19 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
joseph.olstadpatch
Comment #3
joseph.olstadComment #4
joseph.olstadComment #5
joseph.olstadComment #6
joseph.olstadpatch to follow
see
#2760419-19: get_option() micro optimization
Comment #7
joseph.olstadJoel_Pittets patch is the way to go.
we need to check that the array_key_exists because isset when the array element value is null would return false (meaning the test would fail) but we want to know either way.
So back to Joel_Pittets patch. Otherwise we risk breaking something.
According to Joel_Pittets performance analysis this gives a 100x improvement in performance , put into relative terms it is a 3ms improvement!
Comment #8
dawehnerIts certainly not a bad move, given that this is in an uncached scenario not the fastest piece of code.
Comment #9
joseph.olstadComment #11
joseph.olstadRetest fail, retest pass
Comment #13
webchickIf you, like me, were wondering why plain old
if (isset($this->options[$option]))would not be a sufficient check here, @joseph.olstad helpfully explains in #2760419-19: get_option() micro optimization that this is because it's possible for $this->options[$option] to deliberately be set to NULL, which would fail the isset() check, but would be caught in the array_key_exists() check. Learn something new every day! :)Yay for faster code! :D
Committed and pushed to 8.5.x and cherry-picked to 8.4.x.
Comment #16
webchickComment #17
joseph.olstadThanks @webchick. props to joel_pittet for the original D7 patch which is essentially identical other than the file, project, line number and branch (LOL).