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

📝 [Proposal]: Improving route matching and url parsing performance with Ada Url #3019

Closed
3 tasks done
meftunca opened this issue May 30, 2024 · 9 comments
Closed
3 tasks done

Comments

@meftunca
Copy link

Feature Proposal Description

Ada Url can parse url information really fast. Because it processes simd and data in parallel, which means doing multiple operations at once. By parsing url parsing information quickly, we can actually approach the speed of fasthttp.

After Ada Url started using nodejs, they got a really big performance boost. At least we should be able to enable this feature via fiber config.
https://github.com/ada-url/ada#ada-is-fast

Alignment with Express API

It does not include any changes that will affect the interface of Express JS.

HTTP RFC Standards Compliance

This feature only speeds up route matching and url fragmentation. It is not a feature that will break any existing structure.

API Stability

This feature only speeds up route matching and url fragmentation. It is not a feature that will break any existing structure. As I mentioned above, nodejs has provided more than 4x performance increase thanks to this library. It also already uses this library.

Feature Examples

import (
   "github.com/ada-url/goada"
   "fmt"
)

url, err := goada.New("https://www.GOogle.com")
if err != nil {
    t.Error("Expected no error")
}
fmt.Println(url.Href()) // prints https://www.google.com/
url.SetProtocol("http:")
url.SetHash("goada")
fmt.Println(url.Hash()) // prints #goada
fmt.Println(url.Href()) // prints http://www.google.com/#goada

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have searched for existing issues that describe my proposal before opening this one.
  • I understand that a proposal that does not meet these guidelines may be closed without explanation.
Copy link

welcome bot commented May 30, 2024

Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@ReneWerner87
Copy link
Member

ReneWerner87 commented May 30, 2024

thx for the idea

our current route matching is already quite optimized and can keep up with that of aida
image

but we are happy to test it

@meftunca
Copy link
Author

Can you share the results of the comparison with us? @ReneWerner87 :)

@ReneWerner87
Copy link
Member

my screenshot and the numbers from your article

ada average number
image

our route parsing numbers
image

@ReneWerner87
Copy link
Member

ReneWerner87 commented May 30, 2024

perhaps a misunderstanding

we can test the package in fiber and then look at the results
just wanted to show that we already have very good results
but it varies depending on which cases are used, so you can't really say which is faster and test it in an integrated way is a good idea

@ReneWerner87 ReneWerner87 reopened this May 30, 2024
@meftunca
Copy link
Author

Then I'll take the time to do some benchmarks over the weekend if you like, and we'll continue by adding the benchmarks here, along with the existing and island url.

@nickajacks1
Copy link
Member

This requires cgo, which would be a real shame to force on users. If it's included in fiber, I think it should be an optional addon.

@gaby
Copy link
Member

gaby commented Oct 18, 2024

@ReneWerner87 I think we can close this since it requires CGO

@ReneWerner87
Copy link
Member

Ok, thx

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

No branches or pull requests

4 participants