Closed (won't fix)
Project:
Skinr
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
31 May 2011 at 23:31 UTC
Updated:
31 Mar 2012 at 09:54 UTC
Jump to comment: Most recent file
Looking at the query log, it seems that two queries are executed for every region to collect rules. One of them is a redundant collection of rules applied to "page".
This is the case whether or not any rules have been defined.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | rules-module-1174818-7.patch | 38.74 KB | aquariumtap |
| #2 | skinr-1174818-1-rules-module.patch | 50.34 KB | aquariumtap |
| #1 | skinr-1174818-rules-module.patch | 38.07 KB | aquariumtap |
Comments
Comment #1
aquariumtap commentedThis patch moves rule-related logic into its own Skinr Rules module. Otherwise, there are no changes in functionality.
Benefits to a separate module:
Comment #2
aquariumtap commentedActually, look at this patch instead. It goes one step further and removes rule functions from skinr.module, which would fulfill the goal of #959556: Take rules out of skinr.module and put them in modules/skinr.skinr.inc.
Comment #3
moonray commentedThe problem with this patch is that when you no longer require the UI (to lighten load on resources), skinr_rules.module can't be disabled. In fact you can't even disable skinr_ui.module and keep rules functionality.
You need to separate out UI and back-end functionality for this to work.
Comment #4
jurriaanroelofs commented+1 for Self gratification in checking a box next to SKINR RULES
subscribing
Comment #5
aquariumtap commentedHi moonray, thanks for the feedback.
The separated Rules module doesn't rely on the UI module, so that was a extraneous dependency in
skinr_rules.info, easy enough to strip out.I'm not sure if you're suggesting that any UI components in the Skinr Rules module need to be extracted and placed into Skinr UI (or Skinr Rules UI? -- yikes, overkill), but I don't think that would be necessary. There are a few paths registered through hook_menu (
admin/appearance/skinr/rules*), but they wouldn't have any front-end performance impact. If I'm wrong about that, those paths could be registered in skinr_ui.module instead, wrapped in the condition that skinr_rules be enabled.One part of the rules code that I'm unclear about is this:
That would seem to add contextual links for html and region, but I haven't seen those working? Perhaps that should go into the Skinr UI module, but if they're not functional, perhaps the code can be stripped entirely. But I might be missing something.
Thanks.
Comment #6
moonray commentedThose indeed won't work unless you include certain HTML in your page and region template files in your Skinr supporting theme.
See Skinr.org for docs (if it's not in there yet, we need to add that to the docs).
Comment #7
aquariumtap commentedThis revised patch removes any dependencies on the UI and Rules modules from one another.
Some stats:
This isn't a detailed profile and the testing was very simple, but it gives a rough sense of the relative expense of each module. I used a fresh installation of D7.2 with Bartik + Skinr on my local machine, and the numbers above reflect averages on homepage refreshes after the cache had a chance to kick (i.e., after a page is rendered after a cache clear). The memory usage and page execution times were relatively constant between page loads.
Page execution time was hardly affected by the 18 extra queries added by the UI + Rules modules (260ms turned into 282ms), but again, this was run on my local machine where the I/O isn't taxed and there's no latency between PHP and the database.
@moonray - I don't think implementing skins in page/region is in the skinr.org docs yet. Should I open up a task for that?
Comment #8
moonray commentedSome things:
if (module_exists('skinr_rules')) { ... }). But then again, having an additional skinr_rules_ui.module would be overkill as well. Are there any other options?@aquariumtap: and yes, please open a new issue for that.
Comment #9
moonray commentedOne thing to note: if we're going to rely on Context API #1007482: Make use of Context API instead of custom rules rules, and this patch, will become obsolete.
Comment #10
aquariumtap commentedI think @jacine is strongly opposed to replacing rules with anything else, especially if it has an added dependency, so #1007482: Make use of Context API instead of custom rules would be an add-on, and this patch would be its prerequisite to avoid duplicate functionality.
I couldn't think of any other options. I don't particularly like the
module_exists()stuff inside ofhook_menu(), but mostly because those structures are helpful in navigating a module. Other than that, it seems minor.Okay, all sounds good. I'll try to write some tests. Also, it seems some existing ones need to be updated. I see a lot of errors thrown about base themes?
Comment #11
moonray commentedIf you're running tests for Skinr, make sure you have the following core patch: #953336: Contributed modules are not able to test theme-related functionality.
Comment #12
sunI don't really understand why hook_skinr_config_info() is touched or moved in this issue/patch. How do third-party modules integrate with Skinr then?
I mean, my favorite and one of the simplest examples would be admin_menu: I've no rules to expose. I have an admin_menu that can be skinned. (The ultimate goal is to remove admin_menu_toolbar module, which basically does nothing else than to apply a different style to the menu.)
Comment #13
moonray commentedRules is removed from Skinr once #1007482: Make use of Context API instead of custom rules goes through.