While profiling my site, I noticed that quite a lot of time is spent inside filter_xss(). Within the Mini Panels module I noticed a few unnecessary calls. 3 calls can be reduced to 1. This increases performance slightly, especially if you have a lot of mini panels.

This patch saves the result of filter_xss_admin($mini->title) in a temporary variable to avoid calling the function with the same argument twice. It removes the filer_xss_admin() call around $mini->category, because that variable is only allowed to contain 7-bit characters, digits and space.

Comments

c960657’s picture

Title: Avoid too may filter_xss() calls in panels_mini_panels_mini_content_type_content_types() » Add "content type" hook to mini panels content type
StatusFileSize
new3.4 KB

This is a much better approach. This makes the mini panel content type implement content type hook in addition to the default content types hook. This prevents all mini panels from being loaded on every page that contains just a single mini panel.

sdboyer’s picture

Status: Needs review » Fixed

Good call. Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.