fasturl

package module
v0.0.0-...-4e41488 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2023 License: MIT Imports: 1 Imported by: 5

README

Fast URL

FastURL is a Go URL parser using a Ragel state-machine instead of regex, or the built in standard library url.Parse.

Why?

S P E E D

Examples

See our tests

Benchmarks

ns/op

B/op

Raw:

goos: linux
goarch: amd64
pkg: github.com/ImVexed/fasturl
BenchmarkRegex-32         464509              2557 ns/op             530 B/op          3 allocs/op
BenchmarkRagel-32        5350304               225 ns/op              96 B/op          1 allocs/op
BenchmarkStd-32          2225313               537 ns/op             128 B/op          1 allocs/op
PASS
ok      github.com/ImVexed/fasturl      4.405s

How does this work?

Lots of goto's and determinism, feel free to zoom

Credits

maximecaron - Creating the initial ragael parser

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type URL

type URL struct {
	Protocol string
	Host     string
	Port     string
	Path     string
	Query    string
	Fragment string
}

URL represents the different parts of a parsed URL

func ParseURL

func ParseURL(data string) (*URL, error)

ParseURL parses a given URL and returns a `URL` representing the different parts

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL