MCPcopy
hub / github.com/tdewolff/minify / BenchmarkJQuery

Function BenchmarkJQuery

js/js_test.go:1024–1046  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

1022}
1023
1024func BenchmarkJQuery(b *testing.B) {
1025 m := minify.New()
1026 buf, err := os.ReadFile("../benchmarks/sample_jquery.js")
1027 if err != nil {
1028 panic(err)
1029 }
1030 for j := 0; j < 10; j++ {
1031 b.Run(fmt.Sprintf("%d", j), func(b *testing.B) {
1032 b.SetBytes(int64(len(buf)))
1033 for i := 0; i < b.N; i++ {
1034 b.StopTimer()
1035 runtime.GC()
1036 r := buffer.NewReader(parse.Copy(buf))
1037 w := buffer.NewWriter(make([]byte, 0, len(buf)))
1038 b.StartTimer()
1039
1040 if err := Minify(m, w, r, nil); err != nil {
1041 b.Fatal(err)
1042 }
1043 }
1044 })
1045 }
1046}
1047
1048////////////////////////////////////////////////////////////////
1049

Callers

nothing calls this directly

Calls 3

lenFunction · 0.85
RunMethod · 0.80
MinifyFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…