Skip to content

Optimization suggestion: Adding languages to hash table #170

Open
@Peter015

Description

@Peter015

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions