extractNodes puts objects into slow mode #61

Closed
opened 2015-03-26 09:57:54 -07:00 by esprehn · 1 comment
esprehn commented 2015-03-26 09:57:54 -07:00 (Migrated from github.com)

extractNodes calls delete on objects which puts them into slow mode in v8 and other JS engines. Specifically calling delete node.layout; and delete node.children; is bad.

It also adds a children property to the layout objects which means that the code inside the layout algorithm and the code outside are using two different "kinds" of objects in terms of what the JS engine thinks the types are.

It seems like if the layout algorithm wants to create a separate tree of objects it should do that during layout instead of trying to mutate the node tree after the layout. There's also no reason to try to "clean up" the children property if it's empty, just leave the empty arrays. It's better to make all the objects look consistent.

extractNodes calls delete on objects which puts them into slow mode in v8 and other JS engines. Specifically calling delete node.layout; and delete node.children; is bad. It also adds a children property to the layout objects which means that the code inside the layout algorithm and the code outside are using two different "kinds" of objects in terms of what the JS engine thinks the types are. It seems like if the layout algorithm wants to create a separate tree of objects it should do that during layout instead of trying to mutate the node tree after the layout. There's also no reason to try to "clean up" the children property if it's empty, just leave the empty arrays. It's better to make all the objects look consistent.
vjeux commented 2015-06-04 12:25:28 -07:00 (Migrated from github.com)

So sorry about the huge delay for responding to your issues, I somehow didn't see the emails with your issues. All your suggestions are very good! If you still care about this project, please send pull requests and i'll gladly accept them!

So sorry about the huge delay for responding to your issues, I somehow didn't see the emails with your issues. All your suggestions are very good! If you still care about this project, please send pull requests and i'll gladly accept them!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DaddyFrosty/yoga#61
No description provided.