create new tag
, view all tags

Feature Proposals » Control over formfield rendering in a formatted SEARCH


Current State: Developer: Reason: Date: Concerns By: Bug Tracking: Proposed For:
MergedToCore PeterThoeny AcceptedBy7DayFeedbackPeriod 2015-02-25   TWikibug:Item7616 KampalaRelease

Edit Form

DateOfCommitment:   Format: YYYY-MM-DD


I noticed a poor performance on TWiki site that upgraded from TWiki-5.1.4 to TWiki-6.0.1. The site has topics with a number of embedded searches.

Page load time in a sample dashboard:

  • TWiki-5.1.4: 9.6 sec
  • TWiki-6.0.1: 27.1 sec to 30 sec

E.g. a 3 fold increase in page load time.

Support.SID-01982 also reports slow SEARCH.

I did some debugging with enabled Monitor.

One of the culprits I found is sub displayFormField in TWiki::Search. It used 0.2 wallclock secs in TWiki-5.1, and 13.5 wallclock secs in TWiki-6.0. The sub in TWiki-5.1 extracted form field values directly; in TWiki-6.0 it calls $meta->renderFormFieldForDisplay(). When reverting that sub to 5.1 the aforementioned dashboard loads in 13.8 sec, e.g cutting the page load time in half, but still 40% slower than TWiki-5.1.

TWiki-5.1 extracted form field values directly from meta, TWiki-6.1 calls renderFormFieldForDisplay(), e.g. lets field handlers render the value for display. For example the color field has a value, such as #ff33ff (shown as such in a formatted search in TWiki-5.1). The TWiki::Form::Color renders this as a colored square box (shown as such in a formatted search in TWiki-6.0).

Description and Documentation

We want better performance, but we also want proper rendering of form fields in a FormattedSearch. I did some optimization to bypass renderFormFieldForDisplay() where feasible, e.g. when sorting by form field, and if no form field break and no encoding is specified:

  • sort by form field => fast (search extracts value from meta data)
  • $formfield(Some Name) => fast (search extracts value from meta data)
  • $formfield(Some Name, 20, <br />) => slow (call renderFormFieldForDisplay())
  • $formfield(Some Name, encode:html) => slow (call renderFormFieldForDisplay())
  • $formfield(Some Color) => fast, but: Only color value is shown

Now the question: Shall we add a new token to $formfield() to select speed or proper rendering? Which one should be the default?


Note 2015-03-05: Option 1 was implemented, consensus at KampalaReleaseMeeting2015x03x05

Option 1, preferred: Default is fast rendering, but only with raw value:

  • $formfield(Some Color) => fast, but raw value, such as #334466
  • $formfield(Some Color, render:display) => slow, rendered colored square box
  • $formfield(Some Color, render:edit) => possible feature enhancement: render form field for edit
    • Note 2015-03-05: The render:edit was not implemented as part of this feature proposal

Option 2: Default is proper, but slow rendering:

  • $formfield(Some Color) => slow, rendered colored square box
  • $formfield(Some Color, render:display) => fast (identical to above example)
  • $formfield(Some Color, render:raw) => fast, raw value, such as #334466
  • $formfield(Some Color, render:edit) => possible feature enhancement: render form field for edit

Which one is the better option? I prefer option 1, e.g. performance first, and back to behavior of TWiki-5.1.


WhatDoesItAffect: Performance, Search


-- Contributors: Peter Thoeny - 2015-02-25


This would be a "no-brainer" fix, except that I would like to get the input from the community on the best option to fix the performance issue.

-- Peter Thoeny - 2015-02-25

Discussed at KampalaReleaseMeeting2015x03x05 on option 1 vs 2. Consensus: Use option 1 as implemented.

-- Peter Thoeny - 2015-03-05

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2015-03-05 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.