Skip to content
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

what diffence compare with gin #2

Open
xushuhui opened this issue Jun 16, 2021 · 3 comments
Open

what diffence compare with gin #2

xushuhui opened this issue Jun 16, 2021 · 3 comments

Comments

@xushuhui
Copy link

I dont like gin error handle and context part . I want found a fast and slight web framework .
Do you test benchmark gin and ship?
thank you

@xgfone
Copy link
Owner

xgfone commented Jun 17, 2021

Thank you for your interest in this project.

Benchmark

ship refers to echo to implement the route management based on Radix Tree with Zero Garbage.

The benchmark example is located at https://raw.githubusercontent.com/xgfone/ship/master/_benchmark/router_test.go.

Test 1

Dell Vostro 3470
Intel Core i5-7400 3.0GHz
8GB DDR4 2666MHz
Windows 10
Go 1.13.4
Function ops ns/op bytes/opt allocs/op
BenchmarkGinStatic-4 23368 49788 8278 157
BenchmarkGinGitHubAPI-4 15684 75104 10849 203
BenchmarkGinGplusAPI-4 276224 4184 686 13
BenchmarkGinParseAPI-4 157810 7537 1357 26
BenchmarkEchoStatic-4 29432 39989 2432 157
BenchmarkEchoGitHubAPI-4 20527 56857 2468 203
BenchmarkEchoGplusAPI-4 387421 3179 193 13
BenchmarkEchoParseAPI-4 220273 5575 365 26
BenchmarkShipEchoStatic-4 34054 35548 1016 0
BenchmarkShipEchoGitHubAPI-4 21842 54962 1585 0
BenchmarkShipEchoGplusAPI-4 402898 2996 85 0
BenchmarkShipEchoParseAPI-4 223581 5478 154 0

Test 2

MacBook Pro(Retina, 13-inch, Mid 2014)
Intel Core i5 2.6GHz
8GB DDR3 1600MHz
macOS Mojave
Go 1.13.4
Function ops ns/op bytes/opt allocs/op
BenchmarkGinStatic-4 18085 62380 8494 157
BenchmarkGinGitHubAPI-4 12646 93052 11115 203
BenchmarkGinGplusAPI-4 224404 5222 701 13
BenchmarkGinParseAPI-4 124138 9442 1387 26
BenchmarkEchoStatic-4 22624 47401 2021 157
BenchmarkEchoGitHubAPI-4 16822 69059 2654 203
BenchmarkEchoGplusAPI-4 326142 3759 157 13
BenchmarkEchoParseAPI-4 178182 6713 402 26
BenchmarkShipEchoStatic-4 27048 43713 640 0
BenchmarkShipEchoGitHubAPI-4 17545 66953 987 0
BenchmarkShipEchoGplusAPI-4 318595 3698 54 0
BenchmarkShipEchoParseAPI-4 175984 6807 196 0

@xgfone
Copy link
Owner

xgfone commented Jun 17, 2021

Compared to gin, ship has the advantages as bellow:

  • The handler supports to return an error to break off the request handling.
  • Support the route plugins to modify or filter the routes before registering them.
  • Support the middlewares before or after routing the request. But gin only supports the middlewares after routing.
  • Support the multi-virtual hosts. And for the regexp virtual host, you can customized it to implement yourself regexp. See Virtual Host Example.
  • Support to customize the router, so you can implement the different format of the path parameters.
    For the default implementation, it refers to echo and is based on Radix Tree with Zero Garbage. gin is also based on Radix Tree.

@xushuhui
Copy link
Author

I try to ship in my project and pull request or issue if found bug

What is PR rules if I PR ship ? or What is I focus on

I suggest you build a document website to introduce ship . The developer start a simply mini project quick

ship is better and better

Thank your work ,

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

2 participants