-
Notifications
You must be signed in to change notification settings - Fork 27.5k
perf(jqLite): implement and use the empty
method in place of html(‘’)
#4457
Conversation
Thanks for the PR!
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
@mary-poppins I'm just ignoring you from now on, you liar! ;) |
@brian-frichette Good catch! Corrected. |
👍 |
@IgorMinar any chance it'll get into 1.2.0? Or is it too late for that? |
We are not adding new features to 1.2.0 unless it is the best way to fix some critical issue. |
Ok, got it. I guess sth like that can wait for 1.2.1. |
@btford Any chance of getting it merge soon-ish or not really? This provides considerable performance gains for our app but it's a pain to rebase it as it touches an awful lot places in the code base and there are conflicts very often... |
@btford any chance of getting this merged soon? This patch really improve overall performance of angular.js-base apps. |
I'm looking forward to this change and hope It'll be merged soon |
…‘’)` jQuery's elem.html('') is way slower than elem.empty(). As clearing element contents happens quite often in certain scenarios, switching to using .empty() provides a significant performance boost when using Angular with jQuery.
@@ -54,7 +54,7 @@ if (window.jQuery) { | |||
}); | |||
|
|||
it('should fire on html(\'\')', function() { | |||
doc.html(''); | |||
doc.empty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change doesn't make sense. search&replace error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird, I was cautious about such a change in another place but I had to miss it here.
nice PR. thanks! sorry for not merging it sooner. it didn't get tagged properly during initial triage and I haven't noticed it until now. |
Thanks for merging! |
…‘’)` jQuery's elem.html('') is way slower than elem.empty(). As clearing element contents happens quite often in certain scenarios, switching to using .empty() provides a significant performance boost when using Angular with jQuery. Closes angular#4457
…‘’)` jQuery's elem.html('') is way slower than elem.empty(). As clearing element contents happens quite often in certain scenarios, switching to using .empty() provides a significant performance boost when using Angular with jQuery. Closes angular#4457
jQuery's elem.html('') is way slower than elem.empty(). As clearing
element contents happens quite often in certain scenarios, switching
to using .empty() provides a significant performance boost when using
Angular with jQuery.
An example benchmark: http://jsperf.com/html-vs-empty shows extreme performance gains.
It would be great to have it for 1.2.0, especially that it doesn't introduce any breaking changes.
On our current app on a very heavy page the load time was lowered from 2.6s to 2s after applying this patch which gives >20% performance boost.