Skip to content

cgo callback performance #32

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

Open
jbedard opened this issue Jun 3, 2025 · 0 comments
Open

cgo callback performance #32

jbedard opened this issue Jun 3, 2025 · 0 comments

Comments

@jbedard
Copy link

jbedard commented Jun 3, 2025

I'm looking to switch from https://github.com/smacker/go-tree-sitter but I'm finding the performance of https://github.com/tree-sitter/go-tree-sitter to be noticeable slower.

The main difference I'm seeing is the use of cgocallback within the cgo calls. Is this c calling back into golang? Is that necessary?

In this scenario the performance was ~40-50% slower then smacker. Note the 3 main blocks shown are the Tree.Close(), QueryMatch.Next() and ParseWithOptions() calls:

smacker (21s total):
Image

tree-sitter (29s total):
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant