Closed Bug 702642 Opened 13 years ago Closed 12 years ago

DOMTemplate is relatively slow when evaluating JS ${}

Categories

(DevTools :: General, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 11

People

(Reporter: miker, Assigned: jwalker)

Details

Attachments

(1 file)

DOM Templater is relatively slow when evaluating JS ${}. Joe says he has a fix for this.
I'll also pre-compile the regexes while I'm at it.
Assignee: nobody → jwalker
Priority: -- → P2
Summary: DOM Templater is relatively slow when evaluating JS ${} → DOMTemplate is relatively slow when evaluating JS ${}
Would it make sense to have different syntax to explicitly opt-in to an eval rather than a property lookup?
Here's what I'm working on:
Old:

  new Templater().processNode(node, data);

New:

  template(node, data, options);

Where the latter just does 'new Templater(options).processNode(node, data);' behind the scenes.
There is a point to having an object (it allows you to cancel a asynchronous operations, etc). Previously you had to do:

  var t = new Templater();
  t.processNode(node, data);

Now:

  var t = template(node, data);

If 'new Template()' is called without any options, then it sets allowEval:true for backwards compat, however the default for the template() method is allowEval:false
Mike / Dave - would be grateful for some feedback/review of the changes to DOM Template that we recently discussed: For the commits, see https://github.com/joewalker/domtemplate/commits/master for 'Nov 16, 2011'.
Status: NEW → ASSIGNED
Those changes look good to me.
Look fine to me too
Attached patch upload 1Splinter Review
Should be automatic given the comments expressed so far
Attachment #575482 - Flags: review?(dcamp)
Attachment #575482 - Flags: review?(dcamp) → review+
Failures in previous try were not down to this patch, but just in case:
https://tbpl.mozilla.org/?tree=Try&rev=587bd6d86427
Is this ready to land?
Whiteboard: [land-in-fx-team]
Green on try: https://tbpl.mozilla.org/?tree=Try&rev=058542478c55

This could land if it's important for it to do so, but landing early could cause some unnecessary patch churn, which is slightly annoying for me in a separate repo.
Whiteboard: [land-in-fx-team]
OK. Signal when ready.
Whiteboard: [awaiting-go]
https://tbpl.mozilla.org/?tree=Fx-Team&rev=cf3ed4316481
Whiteboard: [awaiting-go] → [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/f1304b596193
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 11
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.