-
Notifications
You must be signed in to change notification settings - Fork 83
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
Initial Go support #153
base: main-dev
Are you sure you want to change the base?
Initial Go support #153
Conversation
Wow, I am surprised the latency is comparable. How long is the input? I believe for Go, it would be great to transpile our C code. |
I'll look at transpiling. I don't expect there to be a significant improvement on these benchmarks - its probably likely to slow things down considerably from what I've read. The strings are 1mb. Below are 10kb strings. Short strings show the same performance except for IndexAny where the go time eventually matches stringzilla.
|
How about super short inputs in the range of 10-100 bytes? |
None of the transpilers work on the stringzilla code. I don't see much information on them. Build flags are the following by the way. -O3 slows us down.
100b
16b
|
Others benchmarking cgo state its 40ns per C call, but I don't see it being that slow. I'll get more of the funcs in as I'm using this in some of my go projects. We can also try manually writing a func or two in go to see how that goes. |
@ashvardanian A) Write Count in C so its one function call to C instead of N calls Let me know and I'll go ahead. The below numbers are for a 9 byte substring to match - strings.Count is faster if the substring to search for is 4 bytes or less.
|
How about we implement the count in the cGo header? |
430f05e
to
f7e4c05
Compare
19e6998
to
4e33434
Compare
e0a9e4e
to
c8c6c7c
Compare
Added a few functions for go. If we merge this I'll finish it up.