simplereach / 51degrees

51Degrees device detection for Go
BSD 2-Clause "Simplified" License
3 stars 3 forks source link

Pure go implementation #2

Open stgleb opened 7 years ago

stgleb commented 7 years ago

Is there any plans to write pure go implementation? We use 51 degrees, but after profiling I've found that it takes 20% of request processing time in CGO call.

elubow commented 7 years ago

I probably won't be doing this. But 51 degrees now has a SWIG implementation which does offer increased performance. I suggest taking a look at that. That's what I implemented in my production app. I just left this up because I know there are still some people using it.

stgleb commented 7 years ago

SWIG? We have tried trie implementation, but in my benchmarks it works even worse. But the main problem is in CGO calls that consumes to much of resources for creating new thread. If you are interested you can look https://github.com/stgleb/benchmark_51degrees .

elubow commented 7 years ago

Have you shown this to the 51degrees team? If not, I'm happy to pass this along to them.

Joseph51D commented 7 years ago

Hi @stgleb

The Go implementation of 51Degrees uses Swig to wrap the exisiting C library. You can find the wrapper in the 51Degrees/Device-Detection:go-beta repository.

Joe