-
Notifications
You must be signed in to change notification settings - Fork 40
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
this code very faster #539
base: master
Are you sure you want to change the base?
Conversation
TODO list:
|
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.
Looking good so far. I'm gonna try review frequently to keep the diff size small
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.
Nice, continues to get closer :)
…ermediate representation
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.
Nice, this is mcuh easier to understand now
Some preliminary performance metrics. (Take with a grain of salt, as with all benchmarks.)
This fork:
Current Master (4.2.27) after running a few times to get JIT advantages:
This fork is about |
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.
Nice, looking good
Did some optimizations:
|
I limited the tree view and trail view to depth 5 for now. The graph engine can easily handle more, but the rendering is too slow. There should be an indicator that a cut-off happened though. |
The total graph rebuilding time is now at |
Some more progress:
|
// Even tho we ensure the graph is built before the views are registered, | ||
// Existing views still try render before the graph is built. | ||
plugin.graph.has_node($active_file_store.path) | ||
let active_file = $derived($active_file_store); |
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'm not quite used to svelte 5 yet. Why do you need to make a reactive variable out of the store?
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.
Because stores are technically deprecated in svelte 5, and using them in certain contexts without making them a derived first can cause some strange issues like duplicated updates.
let edge_sort_id = $state(plugin.settings.views.side.tree.edge_sort_id); | ||
let merge_fields = $state(plugin.settings.views.side.tree.merge_fields); | ||
let show_attributes = $state( | ||
plugin.settings.views.side.tree.show_attributes, | ||
); | ||
let show_node_options = $state( | ||
plugin.settings.views.side.tree.show_node_options, | ||
); | ||
let field_group_labels = $state( | ||
plugin.settings.views.side.tree.field_group_labels, | ||
); | ||
let collapse = $state(plugin.settings.views.side.tree.collapse); |
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.
In a different component, you destructured the settings off of $state(plugin.settings.something)
. Does that work here instead of defining separate variables?
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.
The destructuring is wrong, as it breaks reactivity in svelte 5, but I could probably do one let view_settings = $state(plugin.settings.views.side.tree)
and then use it like view_settings.edge_sort_id
. That would also reduce the amount of $state
.
}), | ||
); | ||
} | ||
|
||
async onOpen() { | ||
const container = this.containerEl.children[1]; | ||
container.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.
Does container.empty()
call this.onClose()
to unmount the component? Or does emptying the container properly destroy the component?
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.
No, container.empty()
only empties the element. I am not sure why the code is the way it is, seems like I didn't touch those lines.
🦀
(feel free to change the name of this PR)