litefmt

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 19

README

Benchmark

goarch: amd64
pkg: github.com/3JoB/ulib/litefmt
cpu: 12th Gen Intel(R) Core(TM) i7-12700H
Benchmark_LiteFMT_Sprint-20         	 2609953	       484.9 ns/op	    1016 B/op	       7 allocs/op
Benchmark_LiteFMT_PSprint_New-20       	 3254678	       383.7 ns/op	     480 B/op	       1 allocs/op
Benchmark_LiteFMT_PSprintP_New-20      	 4159430	       303.3 ns/op	       0 B/op	       0 allocs/op
Benchmark_LiteFMT_VSprint-20        	 1746712	       678.8 ns/op	    1920 B/op	       5 allocs/op
Benchmark_LiteFMT_LSprint-20        	 2286727	       517.3 ns/op	    1016 B/op	       7 allocs/op
Benchmark_LiteFMT_PSprint_OLD-20        	 2296669	       581.3 ns/op	    1016 B/op	       7 allocs/op
Benchmark_LITEFMT_TSprint-20        	 2295609	       526.7 ns/op	    1496 B/op	       8 allocs/op
Benchmark_FMT_Sprint-20             	  223491	      5252 ns/op	    2201 B/op	      98 allocs/op
Benchmark_LiteFMT_Sprintln-20       	 2610094	       450.3 ns/op	    1016 B/op	       7 allocs/op
Benchmark_FMT_Sprintln-20           	  234364	      5145 ns/op	    2201 B/op	      98 allocs/op
Benchmark_L_LITEFMT_Sprint-20       	31340511	        38.41 ns/op	      64 B/op	       2 allocs/op
Benchmark_L_LiteFMT_PSprint_New-20     	34987258	        35.54 ns/op	      48 B/op	       1 allocs/op
Benchmark_L_LiteFMT_PSprintP_New-20    	63030175	        17.90 ns/op	       0 B/op	       0 allocs/op
Benchmark_L_FMT_Sprint-20           	 6037972	       197.7 ns/op	     104 B/op	       4 allocs/op
PASS
ok  	github.com/3JoB/ulib/litefmt	22.262s

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BSprintf added in v1.29.0

func BSprintf(format string, a ...any) []byte

func Print added in v1.33.0

func Print(s ...string)

func Println added in v1.33.0

func Println(s ...string)

func Sprint

func Sprint(s ...string) string

The pooled Sprint method. Of course, you don't need to deal with it. Although pointers will be generated, they are automatically managed by the pool.

func SprintP added in v1.39.0

func SprintP(s ...string) string

The pooled Sprint method. Of course, you don't need to deal with it. Although pointers will be generated, they are automatically managed by the pool.

Oh, right. This PSprint is re-implemented, and its performance far exceeds the old PSprint.

The difference from PSprint is that it uses unsafe to convert []byte to string. Although it returns an immutable value, it can get a huge performance improvement.

func Sprintf

func Sprintf(format string, a ...any) string

func Sprintln

func Sprintln(s ...string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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