You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed that the function tree-sitter-langs--init-major-mode-alist iterates through a list of major mode-language pairs and adds them to the tree-sitter-major-mode-language-alist list. I believe that for improved performance, it would be better to use a hash table instead of iterating through the list. This would allow for constant-time lookups when a buffer is opened.
I have created an implementation that replaces the list with a hash table, and would gladly open a PR. It would also be possible to set the values of the hash table instead of iterating over the list of major-mode pairs.
Please let me know your thoughts on this proposal and if there is any interest.
Thank you!
The text was updated successfully, but these errors were encountered:
Peter015
changed the title
Optimization suggestion: Directly adding languages to hash table
Optimization suggestion: Adding languages to hash table
Jan 23, 2023
I have noticed that the function tree-sitter-langs--init-major-mode-alist iterates through a list of major mode-language pairs and adds them to the tree-sitter-major-mode-language-alist list. I believe that for improved performance, it would be better to use a hash table instead of iterating through the list. This would allow for constant-time lookups when a buffer is opened.
I have created an implementation that replaces the list with a hash table, and would gladly open a PR. It would also be possible to set the values of the hash table instead of iterating over the list of major-mode pairs.
Please let me know your thoughts on this proposal and if there is any interest.
Thank you!
The text was updated successfully, but these errors were encountered: