DOMTemplate is relatively slow when evaluating JS ${}

RESOLVED FIXED in Firefox 11

Status

()

Firefox
Developer Tools
P2
normal
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: miker, Assigned: jwalker)

Tracking

unspecified
Firefox 11
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

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 ${}

Comment 2

6 years ago
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

Comment 5

6 years ago
Those changes look good to me.
Look fine to me too
Created attachment 575482 [details] [diff] [review]
upload 1

Should be automatic given the comments expressed so far
Attachment #575482 - Flags: review?(dcamp)

Updated

6 years ago
Attachment #575482 - Flags: review?(dcamp) → review+
https://tbpl.mozilla.org/?tree=Try&rev=28134b5df88a
Failures in previous try were not down to this patch, but just in case:
https://tbpl.mozilla.org/?tree=Try&rev=587bd6d86427

Comment 10

6 years ago
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
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 11
You need to log in before you can comment on or make changes to this bug.