Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,35 @@ jobs:
test:
strategy:
matrix:
go-version: [1.15.x,1.14.x,1.13.x]
go-version: [1.17.x,1.20.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: Priming Cache
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-v1-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-v1-go-

- name: Checkout code
uses: actions/checkout@v2

- name: Lint
if: matrix.platform == 'ubuntu-latest' && matrix.go-version == '1.15.x'
run: |
export PATH=$PATH:$(go env GOPATH)/bin # temporary fix. See https://github.com/actions/setup-go/issues/14
go get -u golang.org/x/lint/golint
golint -set_exit_status ./...
uses: actions/checkout@v3

- name: Test
run: go test ./...
run: go test ./...

golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GOCMD=GO111MODULE=on go

lint:
golint -set_exit_status ./...
golangci-lint run

test:
$(GOCMD) test -cover -race ./...
Expand Down
49 changes: 20 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package pure
============
<img align="right" src="https://raw.githubusercontent.com/go-playground/pure/master/logo.png">![Project status](https://img.shields.io/badge/version-5.2.0-green.svg)
<img align="right" src="https://raw.githubusercontent.com/go-playground/pure/master/logo.png">![Project status](https://img.shields.io/badge/version-5.3.0-green.svg)
[![Build Status](https://travis-ci.org/go-playground/pure.svg?branch=master)](https://travis-ci.org/go-playground/pure)
[![Coverage Status](https://coveralls.io/repos/github/go-playground/pure/badge.svg?branch=master)](https://coveralls.io/github/go-playground/pure?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/pure)](https://goreportcard.com/report/github.com/go-playground/pure)
Expand Down Expand Up @@ -163,7 +163,7 @@ Run on i5-7600 16 GB DDR4-2400 using Go version go1.12.5 darwin/amd64
NOTICE: pure uses a custom version of [httprouter](https://github.com/julienschmidt/httprouter)'s radix tree, benchmarks can be found [here](https://github.com/deankarn/go-http-routing-benchmark/tree/pure-and-lars) the slowdown is with the use of the `context` package, as you can see when no SEO params are defined, and therefore no need to store anything in the context, it is faster than even lars.

```go
go test -bench=. -benchmem=true
go test -bench=. -benchmem=true ./...
#GithubAPI Routes: 203
Pure: 37096 Bytes

Expand All @@ -178,35 +178,26 @@ go test -bench=. -benchmem=true
Pure: 21096 Bytes


BenchmarkPure_Param 10000000 184 ns/op 384 B/op 2 allocs/op
BenchmarkPure_Param5 10000000 236 ns/op 384 B/op 2 allocs/op
BenchmarkPure_Param20 5000000 393 ns/op 384 B/op 2 allocs/op
BenchmarkPure_ParamWrite 5000000 240 ns/op 384 B/op 2 allocs/op
BenchmarkPure_GithubStatic 50000000 36.2 ns/op 0 B/op 0 allocs/op
BenchmarkPureGithubParam 10000000 230 ns/op 384 B/op 2 allocs/op
BenchmarkPure_GithubAll 30000 43887 ns/op 64130 B/op 334 allocs/op
BenchmarkPure_GPlusStatic 50000000 22.8 ns/op 0 B/op 0 allocs/op
BenchmarkPure_GPlusParam 10000000 192 ns/op 384 B/op 2 allocs/op
BenchmarkPure_GPlus2Params 10000000 211 ns/op 384 B/op 2 allocs/op
BenchmarkPure_GPlusAll 500000 2457 ns/op 4224 B/op 22 allocs/op
BenchmarkPure_ParseStatic 100000000 23.7 ns/op 0 B/op 0 allocs/op
BenchmarkPure_ParseParam 10000000 177 ns/op 384 B/op 2 allocs/op
BenchmarkPure_Parse2Params 10000000 193 ns/op 384 B/op 2 allocs/op
BenchmarkPure_ParseAll 500000 3751 ns/op 6144 B/op 32 allocs/op
BenchmarkPure_StaticAll 200000 8574 ns/op 0 B/op 0 allocs/op
goos: darwin
goarch: arm64
BenchmarkPure_Param 11965519 100.4 ns/op 256 B/op 1 allocs/op
BenchmarkPure_Param5 8756385 138.6 ns/op 256 B/op 1 allocs/op
BenchmarkPure_Param20 4335284 276.5 ns/op 256 B/op 1 allocs/op
BenchmarkPure_ParamWrite 9980685 120.0 ns/op 256 B/op 1 allocs/op
BenchmarkPure_GithubStatic 47743062 24.77 ns/op 0 B/op 0 allocs/op
BenchmarkPure_GithubParam 8514968 139.8 ns/op 256 B/op 1 allocs/op
BenchmarkPure_GithubAll 42250 28333 ns/op 42753 B/op 167 allocs/op
BenchmarkPure_GPlusStatic 87363000 13.39 ns/op 0 B/op 0 allocs/op
BenchmarkPure_GPlusParam 10398274 113.0 ns/op 256 B/op 1 allocs/op
BenchmarkPure_GPlus2Params 9235220 128.7 ns/op 256 B/op 1 allocs/op
BenchmarkPure_GPlusAll 792037 1526 ns/op 2816 B/op 11 allocs/op
BenchmarkPure_ParseStatic 79194198 14.96 ns/op 0 B/op 0 allocs/op
BenchmarkPure_ParseParam 11391336 104.5 ns/op 256 B/op 1 allocs/op
BenchmarkPure_Parse2Params 10103078 116.2 ns/op 256 B/op 1 allocs/op
BenchmarkPure_ParseAll 498306 2417 ns/op 4096 B/op 16 allocs/op
BenchmarkPure_StaticAll 219930 5225 ns/op 0 B/op 0 allocs/op
```

Package Versioning
----------
I'm jumping on the vendoring bandwagon, you should vendor this package as I will not
be creating different version with gopkg.in like allot of my other libraries.

Why? because my time is spread pretty thin maintaining all of the libraries I have + LIFE,
it is so freeing not to worry about it and will help me keep pouring out bigger and better
things for you the community.

I am open versioning with gopkg.in should anyone request it, but this should be stable going forward.

Licenses
--------
- [MIT License](https://raw.githubusercontent.com/go-playground/pure/master/LICENSE) (MIT), Copyright (c) 2016 Dean Karn
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module github.com/go-playground/pure/v5

require (
github.com/go-playground/assert/v2 v2.0.1
github.com/go-playground/pkg/v5 v5.2.0
github.com/go-playground/assert/v2 v2.2.0
github.com/go-playground/pkg/v5 v5.21.1
)

go 1.15
require github.com/go-playground/form/v4 v4.2.0 // indirect

go 1.18
21 changes: 6 additions & 15 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
github.com/go-playground/assert v1.2.1 h1:ad06XqC+TOv0nJWnbULSlh3ehp5uLuQEojZY5Tq8RgI=
github.com/go-playground/assert v1.2.1/go.mod h1:Lgy+k19nOB/wQG/fVSQ7rra5qYugmytMQqvQ2dgjWn8=
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/form/v4 v4.0.0 h1:vUKi2K1Hqlc4rpBc0tCclgs9zSfbY5yMKsL106db/eY=
github.com/go-playground/form/v4 v4.0.0/go.mod h1:bodWfd97U9PVMZFcDsbVzSbQQTtaWrebnTwQtWjSW1M=
github.com/go-playground/form/v4 v4.1.1 h1:1T9lGt3WRHuDwT5uwx7RYQZfxVwWZhF0DC1ovKyNnWY=
github.com/go-playground/form/v4 v4.1.1/go.mod h1:q1a2BY+AQUUzhl6xA/6hBetay6dEIhMHjgvJiGo6K7U=
github.com/go-playground/pkg v1.0.1 h1:EsBCgjDTrlaLCflFChT2Q/M4unQQS6DnBDvHTA+fVAI=
github.com/go-playground/pkg v1.0.1/go.mod h1:P1pn/auRkxPy9n7eXlvyyJpBIvxdH6ZUtHOGOLfBaBA=
github.com/go-playground/pkg/v4 v4.0.0 h1:0lTr9H8RyCwom4TcfNhMCNvlTlFuin7uUlXcZQuxrA4=
github.com/go-playground/pkg/v4 v4.0.0/go.mod h1:TLowM3d3a/m04JlHK/zM6Ia8zf8+0C/9pTwhDEUqKO0=
github.com/go-playground/pkg/v5 v5.1.0 h1:odCGeJgAQFjoU8eMfT0jjqeMoa4KspymUIq+vi5NpEk=
github.com/go-playground/pkg/v5 v5.1.0/go.mod h1:0380E0lsFB1POWFypOLL8tX2f0O1OBCBpSdVmEy4mg0=
github.com/go-playground/pkg/v5 v5.2.0 h1:rjauo+ugKwbpX/wxGdhLQHMba2PMwtOXhB5HdV9l3Ow=
github.com/go-playground/pkg/v5 v5.2.0/go.mod h1:4JbhbKhH362Z8RQ7XBVlvysNbGUNgiMVo2Iuyy36qhc=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/form/v4 v4.2.0 h1:N1wh+Goz61e6w66vo8vJkQt+uwZSoLz50kZPJWR8eic=
github.com/go-playground/form/v4 v4.2.0/go.mod h1:q1a2BY+AQUUzhl6xA/6hBetay6dEIhMHjgvJiGo6K7U=
github.com/go-playground/pkg/v5 v5.21.1 h1:X5yWP+S+wMFHBX1mUMCgsum3yw0FKaabd9vs27xjilg=
github.com/go-playground/pkg/v5 v5.21.1/go.mod h1:eT8XZeFHnqZkfkpkbI8ayjfCw9GohV2/j8STbVmoR6s=