MCPcopy Create free account
hub / github.com/dop251/goja / BenchmarkArrayPut

Function BenchmarkArrayPut

array_test.go:95–121  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

93}
94
95func BenchmarkArrayPut(b *testing.B) {
96 b.StopTimer()
97 r := New()
98
99 v := &Object{runtime: r}
100
101 a := &arrayObject{
102 baseObject: baseObject{
103 val: v,
104 extensible: true,
105 },
106 }
107
108 v.self = a
109
110 a.init()
111
112 var idx Value = valueInt(0)
113 var val Value = asciiString("test")
114
115 b.StartTimer()
116
117 for i := 0; i < b.N; i++ {
118 v.setOwn(idx, val, false)
119 }
120
121}
122
123func BenchmarkArraySetEmpty(b *testing.B) {
124 r := New()

Callers

nothing calls this directly

Calls 5

initMethod · 0.95
setOwnMethod · 0.95
NewFunction · 0.85
valueIntTypeAlias · 0.85
asciiStringTypeAlias · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…