Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2-3000% performance enhancement in IE7 #253

Merged
merged 4 commits into from
Apr 11, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/dust.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ Context.prototype.current = function() {

Context.prototype.getBlock = function(key, chk, ctx) {
if (typeof key === "function") {
key = key(chk, ctx).data;
chk.data = "";
key = key(chk, ctx).data.join("");
chk.data = []; //ie7 perf
}

var blocks = this.blocks;
Expand Down Expand Up @@ -229,7 +229,7 @@ Stub.prototype.flush = function() {

while (chunk) {
if (chunk.flushable) {
this.out += chunk.data;
this.out += chunk.data.join(""); //ie7 perf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would there be a significant improvement by changing this.out to an array instead of a string?

} else if (chunk.error) {
this.callback(chunk.error);
this.flush = function() {};
Expand All @@ -252,7 +252,7 @@ Stream.prototype.flush = function() {

while(chunk) {
if (chunk.flushable) {
this.emit('data', chunk.data);
this.emit('data', chunk.data.join("")); //ie7 perf
} else if (chunk.error) {
this.emit('error', chunk.error);
this.flush = function() {};
Expand Down Expand Up @@ -308,7 +308,7 @@ Stream.prototype.pipe = function(stream) {
function Chunk(root, next, taps) {
this.root = root;
this.next = next;
this.data = '';
this.data = []; //ie7 perf
this.flushable = false;
this.taps = taps;
}
Expand All @@ -319,7 +319,7 @@ Chunk.prototype.write = function(data) {
if (taps) {
data = taps.go(data);
}
this.data += data;
this.data.push(data);
return this;
};

Expand Down
10 changes: 5 additions & 5 deletions test/uutest.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ Test.prototype.run = function() {
}

Test.prototype.equals = function(actual, expected, message) {
if (actual !== expected) {
var err = new Error();
if (message) err.message = message;
throw wrapAssertionError(err, actual, expected, "===");
}
if (actual !== expected) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be removed from the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the change in my last checkin. The fix (lines 23-27) is incorrect and not needed after the checkins by nicklassigurdh.

var err = new Error();
if (message) err.message = message;
throw wrapAssertionError(err, actual, expected, "===");
}
}

Test.prototype.ifError = function(err) {
Expand Down