-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Create and Delete Events Generate Lots of Detached Nodes #2795
Comments
These are being kept alive by the undo stack on the workspace--calling |
@picklesrus @ewpatton Do you folks already have a depth on the undo queue to solve this? |
We do not set a limit in App Inventor.
It would be interesting to do some performance tests to see how much it affects us, but based on previous experience it’s the layout and render passes over many blocks that tend to make our workspace bog down once N is large. I’d be interested in seeing how that ends up changing with the new rendering pipeline.
…Sent from my iPhone
On Sep 10, 2019, at 18:33, Rachel Fenichel ***@***.***> wrote:
@picklesrus @ewpatton Do you folks already have a depth on the undo queue to solve this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I think this would matter if you have a long-lived workspace, like a tab you've had open for a lot of time and have been poking at. Maybe also when opening a giant workspace, since that would create these all at once, so that could be a good way to check. |
Long lived workspaces, possibly, but it’s not yet clear exactly how much memory is “leaking” there. Since we don’t record events during load, there shouldn’t be anything on the undo stack at the start of a session even for large projects. I can run some tests and get concrete numbers on Thursday.
…Sent from my iPhone
On Sep 10, 2019, at 19:50, Rachel Fenichel ***@***.***> wrote:
I think this would matter if you have a long-lived workspace, like a tab you've had open for a lot of time and have been poking at. Maybe also when opening a giant workspace, since that would create these all at once, so that could be a good way to check.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I ran some tests in Chrome. My results were fairly consistent between runs, so I have confidence in the results.
Now comment out the two lines where oldXml is set and repeat:
This indicates that the XML (the detached Nodes) takes 100 KB. By comparison, converting this XML to text:
My conclusions are:
|
I should follow up and say that this is absolutely a topic that should be explored. There may be monsters lurking in our memory management that we aren't aware of. Like that time when we discovered that the connection database was O(n^2) and was using the majority of our CPU time due to a trivial inefficiency. There are not a lot of eyes on our memory heap, so it's a promising thing to poke at. Thank you @BeksOmega! |
Turns out we have a MAX_UNDO, so this is bounded (as well as being small per-block). Closing. |
Describe
Create and delete events generate lots of detached nodes.
This is because those events store the xml of the created/deleted blocks.
To Observe
Steps to observe the behavior:
A) Go to the memory tab of the chrome dev tools.
B) Select the Heap Snapshot button.
C) Press the "Take Snapshot" button.
D) In the "Class filter" type in "Detached"
Describe the solution you'd like
Honestly, I know that detached nodes are bad but I don't know what you're supposed to do instead, since these are being used for storage purposes.
Maybe storing the block information as JSON would be better? I have designed a system for adding JSON serialization to the Blockly serializer.
Describe alternatives you've considered
Maybe converting the dom to text would be better? But again I really have no knowledge in this area.
Additional context
Tracking issue requested by Rachel.
The text was updated successfully, but these errors were encountered: