Project

General

Profile

Actions

Feature #44415

closed

Reduce icon rendering time by caching sprite paths

Added by Go MAEDA 22 days ago. Updated 17 days ago.

Status:
Closed
Priority:
Normal
Category:
Performance
Target version:
Resolution:
Fixed

Description

IconsHelper#svg_sprite_icon calls asset_path to resolve the sprite path for every icon rendered on a page. However, a page typically uses only a few sprites: Redmine's bundled icons.svg, plus icons.svg plus any icons.svg provided by the theme or plugins. The same paths are therefore resolved many times.

The attached patch memoizes the resolved path for each sprite in the view instance, so each path is resolved only once per request.

On my development machine, the total time for 370 calls to sprite_icon, which calls svg_sprite_icon internally, on an issue page with 30 journals and 30 attachments decreased from 3.9 ms to 2.2 ms, a reduction of about 40%.


Files

Actions #1

Updated by Go MAEDA 22 days ago

  • Tracker changed from Defect to Feature
Actions #2

Updated by Marius BĂLTEANU 21 days ago

  • Assignee set to Marius BĂLTEANU
Actions #3

Updated by Marius BĂLTEANU 18 days ago

  • Status changed from New to Resolved
  • Target version set to 6.1.5
  • Resolution set to Fixed
Actions #4

Updated by Marius BĂLTEANU 17 days ago

  • Status changed from Resolved to Closed

Merged to stable branches!

Actions

Also available in: Atom PDF