-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix test cases. #1
Conversation
First, regions have a pointer to its el. No need for a lookup. Second, I'm detaching all contents before running the replaces. Third, never replace top view's el, just modify.
With these changes: Test 2
Test 3
|
@@ -26,11 +29,11 @@ | |||
// them with cloned versions of the elements in the existing | |||
// tree. This causes 0 ops | |||
$listClone.children().each(function(index, li) { | |||
$(li).replaceWith(test.$el.find('.'+li.className).clone(true, true)); |
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.
I think we want the clone to deeply clone data and events, right?
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.
Correct, let me update.
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.
Actually, it defaults to the value of withDataAndEvents
. 😃
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.
Oh, would ya look at that!
Looking good, looking good. Just one Q, and I'll merge it in! |
Additionally, I was able to kick both test's asses using the same kind of placeholder that I used in regions. It's in test 4. Test 4
|
It uses a placeholder, so we don't have to detach each child node, just the parent.
Everything I've read suggests to me that there's got to be some test case we can find where the 10k+ DOM op methods will be incredibly slow...maybe mobile? There's no way people would talk so much about slow reflows if these DOM operations were so quick. ...right? |
I thought so too. I read http://korynunn.wordpress.com/2013/03/19/the-dom-isnt-slow-you-are/, and while it's a bit aggressive, it brings up one very good point:
I think if you incrementally add/remove/replace like the original test 2 was doing, you're gonna have a slow time. But the DOM is fast, it's just not object property access fast. |
I should clarify...whenever I refer to DOM ops, I really mean the ones that affect nodes that are children of the I expect that the DOM, when detached, will function performance-wise on the same order of magnitude as VDom. The whole point of VDom, as I understand it, is to reduce the # of those DOM ops that could cause reflows. Yet these tests seem to be showing that my thinking on this may simply be completely wrong :) I was also thinking that your tests would show an empty list for some time, but, it seems they're blinking exactly the same. |
Checking out this article, I'm wondering if this may have something to do with it:
It's probably worthwhile to test these on various devices, too. |
Probably. I don't think a reflow can happen until the event loop moves on? |
First, regions have a pointer to its el. No need for a lookup. Second, I'm
detaching all contents before running the replaces. Third, never replace
top view's el, just modify.