#7156 closed enhancement (duplicate)
html can be ~33% faster
Reported by: | markg85 | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | manipulation | Version: | 1.4.2 |
Keywords: | html | Cc: | |
Blocked by: | Blocking: |
Description (last modified by )
Hi,
I was playing a bit with the jquery source (1.4.3 RC1) and found that the "html:" function can be ~33% faster simply by removing the "shortcut" option...
here is the code part that i have now and is a consistently faster from 37ms to 21ms:
html: function( value ) { if ( value === undefined ) { return this[0] && this[0].nodeType === 1 ? this[0].innerHTML.replace(rinlinejQuery, "") : null; } else if ( jQuery.isFunction( value ) ) { this.each(function(i){ var self = jQuery(this); self.html( value.call(this, i, self.html()) ); }); } else { this.empty().append( value ); } return this; },
Apparently something in the "shortcut" path was draining cycles?
Regards, Mark
Change History (6)
comment:1 Changed 13 years ago by
Keywords: | html added |
---|---|
Type: | bug → enhancement |
comment:2 Changed 13 years ago by
Component: | unfiled → manipulation |
---|---|
Description: | modified (diff) |
Priority: | undecided → low |
Status: | new → open |
The more complex the HTML, the faster the “shortcut” method should be. How complex is the HTML that you are testing here?
comment:3 Changed 13 years ago by
I actually tested this with the "taskspeed" benchmarking tool. I didn't add/change any text.. it's just that tool only with those lines removed.
comment:5 Changed 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | open → closed |
Note: See
TracTickets for help on using
tickets.
Two other people have suggested this idea quite recently but I'm currently trying to track down the tickets so we can reference them.
I'll see if I can find out why we're specifically using 'shortcut' in the above and follow up.
Moving to enhancements for now.