[PERF] Don't Attempt To Sanitize Unsanitizeable#429
[PERF] Don't Attempt To Sanitize Unsanitizeable#429chadhietala wants to merge 1 commit intotildeio:masterfrom
Conversation
|
such |
1e156d3 to
7e17f18
Compare
packages/morph-attr/lib/main.js
Outdated
There was a problem hiding this comment.
doesn't this just just mean all truthy things are left unescaped ?
On another unrelated note, the this.escaped flag name sucks, we should have named it needsEscape or something
There was a problem hiding this comment.
Maybe I don't understand what is going on here but if this.escape === true, then the value we are trying to escape should be at least truthy. Currently we run the block with undefined or strings. The sanitized value of undefined will be undefined, but clearly there is a micro-opt to be had here. I added the function instead of doing
if (this.escaped && value) {
}
There was a problem hiding this comment.
ah, this aims to skips escaping if the value is falsy. As we believe no falsey values will need escaping.
There was a problem hiding this comment.
Whats the reason for the method?
|
needs señor tests. |
This adds an identity check for falsy values before the value is sanitized. Currently we do work to sanitize things like `undefined`.
7e17f18 to
ad89efe
Compare
|
Not really sure how to test this as the sanitization function is local. Not sure how helpful the test is. |
There was a problem hiding this comment.
Typo: "undefiend" should be "undefined"
This adds an identity check for falsy values before the value is
sanitized. Currently we do work to sanitize things like
undefined.This is from a bench of a thousand

link-tosBefore:
After:
