Closed (fixed)
Project:
Homebox - Individual user dashboards
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
15 Dec 2011 at 23:28 UTC
Updated:
14 Mar 2015 at 23:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Matt-H commentedThis patch improves performance by setting a static variable and caching the query results.
Comment #2
roderik1) if _homebox_can_view_block() is called multiple times per HTTP request with different arguments every time (i.e. module+delta), then this still doesn't make a difference, because database queries are still being made for every call.
2) Why cache_get() being used here, in addition to the static variable? It's caching the small result of one small SQL query. It doesn't seem to me like the cache_get() is necessarily faster then the query itself - so that would just adds code bloat without speedup.
Attached patch caches all roles at once, so makes only one SQL query (even though that one query may take a little longer). I think this one makes more sense.
Comment #4
drummLooks good, committed.