View Issue Details

IDProjectCategoryView StatusLast Update
0002377Composrcorepublic2016-06-26 22:45
ReporterChris GrahamAssigned ToChris Graham 
SeverityFeature-request 
Status closedResolutionwon't fix 
Product Version 
Fixed in Version 
Summary0002377: Tempcode optimisation - conditional parameter generation
DescriptionDon't generate and pass parameters into templates that we think may not be used...

Example: BOX attribute for CNS_MEMBER_DIRECTORY_USERNAME may not be used in final template if the box tooltips are disabled, but is very heavy load so we don't want to generate it and carry it in the tree if not needed

Create a template_may_use($template, $parameter) function
template_may_use will work by having the run-time template cache prepped and querying the unbound Tempcode object within it; do_template and template_may_use may now both use a common function that does that cache prepping, to simplify the do_template code

Make a temporary scanner to log all unused parameters so that we can mass-correct across the code-base

template_may_use has to be aware that INCLUDE directives's may change what parameters are used - it has to be able to recurse into them
Additional InformationParticularly see all the stuff put into catalogue templates, e.g....

            // Different ways of accessing the main field value, and pure version of it
            $field_name = get_translated_text($field['cf_name']);
            //$map['FIELDNAME_' . $str_i] = $field_name;
            //$fields_2d[] = array('NAME' => $field_name, 'VALUE' => $use_ev);
            $field_type = $field['cf_type'];
            //$map['FIELDTYPE_' . $str_i] = $field_type;
            $map['FIELD_' . $str_i] = $use_ev;
            $map['_FIELD_' . $str_id] = &$map['FIELD_' . $str_i];
            if ($use_ev === $ev) {
                $map['FIELD_' . $str_i . '_PLAIN'] = &$map['FIELD_' . $str_i];
            } else {
                $map['FIELD_' . $str_i . '_PLAIN'] = $ev;
            }
            $map['_FIELD_' . $str_id . '_PLAIN'] = &$map['FIELD_' . $str_i . '_PLAIN'];
            if ($ev === $field['effective_value_pure']) {
                $map['FIELD_' . $str_i . '_PURE'] = &$map['FIELD_' . $str_i . '_PLAIN'];
            } else {
                $map['FIELD_' . $str_i . '_PURE'] = $field['effective_value_pure'];
            }
            $map['_FIELD_' . $str_id . '_PURE'] = &$map['FIELD_' . $str_i . '_PURE'];
TagsType: Performance
Time estimation (hours)7
Sponsorship open

Activities

Chris Graham

2016-04-26 04:47

administrator   ~0003751

If this is implemented we can remove the no_catalogue_field_assembly* hidden options.

Chris Graham

2016-06-26 22:45

administrator   ~0004067

This isn't really necessary now, as 0002502 created an automatic remover for unused Tempcode parameters before things enter the block cache. It doesn't matter than unneeded parameters are generated prior to the cache being populated, as normative performance is after the cache is full.

This is a cleaner solution.

Issue History

Date Modified Username Field Change
2016-04-05 17:25 Chris Graham New Issue
2016-04-05 17:25 Chris Graham Tag Attached: Type: Performance
2016-04-24 20:37 Chris Graham Additional Information Updated View Revisions
2016-04-26 04:47 Chris Graham Note Added: 0003751
2016-06-26 22:45 Chris Graham Note Added: 0004067
2016-06-26 22:45 Chris Graham Status non-assigned => closed
2016-06-26 22:45 Chris Graham Assigned To => Chris Graham
2016-06-26 22:45 Chris Graham Resolution open => won't fix