MCPcopy Index your code
hub / github.com/yuin/gopher-lua / BenchmarkRegistryPushPopAutoGrow

Function BenchmarkRegistryPushPopAutoGrow

state_test.go:715–731  ·  view source on GitHub ↗

test pushing and popping from the registry

(t *testing.B)

Source from the content-addressed store, hash-verified

713
714// test pushing and popping from the registry
715func BenchmarkRegistryPushPopAutoGrow(t *testing.B) {
716 al := newAllocator(32)
717 sz := 256 * 20
718 reg := newRegistry(registryTestHandler(0), sz/2, 64, sz, al)
719 value := LString("test")
720
721 t.ResetTimer()
722
723 for j := 0; j < t.N; j++ {
724 for i := 0; i < sz; i++ {
725 reg.Push(value)
726 }
727 for i := 0; i < sz; i++ {
728 reg.Pop()
729 }
730 }
731}
732
733func BenchmarkRegistryPushPopFixed(t *testing.B) {
734 al := newAllocator(32)

Callers

nothing calls this directly

Calls 6

newAllocatorFunction · 0.85
registryTestHandlerTypeAlias · 0.85
LStringTypeAlias · 0.85
newRegistryFunction · 0.70
PushMethod · 0.65
PopMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…