File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -656,6 +656,50 @@ func Benchmark_Router_Next_Default_Parallel(b *testing.B) {
656
656
})
657
657
}
658
658
659
+ // go test -v ./... -run=^$ -bench=Benchmark_Router_Next_Default_Immutable -benchmem -count=4
660
+ func Benchmark_Router_Next_Default_Immutable (b * testing.B ) {
661
+ app := New (Config {Immutable : true })
662
+ app .Get ("/" , func (_ Ctx ) error {
663
+ return nil
664
+ })
665
+
666
+ h := app .Handler ()
667
+
668
+ fctx := & fasthttp.RequestCtx {}
669
+ fctx .Request .Header .SetMethod (MethodGet )
670
+ fctx .Request .SetRequestURI ("/" )
671
+
672
+ b .ReportAllocs ()
673
+ b .ResetTimer ()
674
+
675
+ for n := 0 ; n < b .N ; n ++ {
676
+ h (fctx )
677
+ }
678
+ }
679
+
680
+ // go test -benchmem -run=^$ -bench ^Benchmark_Router_Next_Default_Parallel_Immutable$ github.com/gofiber/fiber/v3 -count=1
681
+ func Benchmark_Router_Next_Default_Parallel_Immutable (b * testing.B ) {
682
+ app := New (Config {Immutable : true })
683
+ app .Get ("/" , func (_ Ctx ) error {
684
+ return nil
685
+ })
686
+
687
+ h := app .Handler ()
688
+
689
+ b .ReportAllocs ()
690
+ b .ResetTimer ()
691
+
692
+ b .RunParallel (func (pb * testing.PB ) {
693
+ fctx := & fasthttp.RequestCtx {}
694
+ fctx .Request .Header .SetMethod (MethodGet )
695
+ fctx .Request .SetRequestURI ("/" )
696
+
697
+ for pb .Next () {
698
+ h (fctx )
699
+ }
700
+ })
701
+ }
702
+
659
703
// go test -v ./... -run=^$ -bench=Benchmark_Route_Match -benchmem -count=4
660
704
func Benchmark_Route_Match (b * testing.B ) {
661
705
var match bool
You can’t perform that action at this time.
0 commit comments