-
Notifications
You must be signed in to change notification settings - Fork 272
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
Let's discuss performance #19
Comments
Hay :) I haven't done the benchmark yet, but it doesn't surprise me since the reflect API relies on allocations, however it's in my TODO |
I have added a performance section in the README, you are totally right on this point we must bring this subject on the table and also provide typesafe solutions (less flexible). |
Typesafe implementations are on the way, I will add more benchmarks bit by bit. |
Wow! You've been busy! Excellent work. I'd love to explore why using reflection has so many more allocations, 10 minutes on google wasn't enlightening. Would make a good article. |
@christian-blades-cb, would doing some memory profiling with the |
@thoas I have implemented a way to avoid the cost of reflect.Value https://github.com/json-iterator/go/blob/master/feature_reflect.go The general idea only rely on reflect.Type to assemble your function logic through composition. Then working with raw unsafe.Pointer directly. Essentially, interface{} is a reflect.Type + raw pointer. |
I was curious what the performance impact is of your functional implementation vs the classic implementations. I haven't gone in depth, but the results are interesting (in particular the memory allocations for
Contains
.)The text was updated successfully, but these errors were encountered: