Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for BenchmarkUnsafeStrings (0.22 sec)

  1. src/log/slog/value_test.go

    // A Value with "unsafe" strings is significantly faster:
    // safe:  1785 ns/op, 0 allocs
    // unsafe: 690 ns/op, 0 allocs
    
    // Run this with and without -tags unsafe_kvs to compare.
    func BenchmarkUnsafeStrings(b *testing.B) {
    	b.ReportAllocs()
    	dst := make([]Value, 100)
    	src := make([]Value, len(dst))
    	b.Logf("Value size = %d", unsafe.Sizeof(Value{}))
    	for i := range src {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 16:12:08 UTC 2024
    - 6.9K bytes
    - Viewed (0)
Back to top