diff --git a/internal/ops/ops.go b/internal/ops/ops.go index 31d3e532..0c8e0cf2 100644 --- a/internal/ops/ops.go +++ b/internal/ops/ops.go @@ -141,18 +141,6 @@ func (o *Ops) Reset() { o.version++ } -func (o *Ops) Data() []byte { - return o.data -} - -func (o *Ops) Refs() []interface{} { - return o.refs -} - -func (o *Ops) Version() int { - return o.version -} - func (o *Ops) Write(n int) []byte { o.data = append(o.data, make([]byte, n)...) return o.data[len(o.data)-n:] diff --git a/internal/ops/reader.go b/internal/ops/reader.go index 7884122a..7aafdac3 100644 --- a/internal/ops/reader.go +++ b/internal/ops/reader.go @@ -81,9 +81,9 @@ func (r *Reader) Decode() (EncodedOp, bool) { continue } } - data := r.ops.Data() + data := r.ops.data data = data[r.pc.data:] - refs := r.ops.Refs() + refs := r.ops.refs if len(data) == 0 { if r.deferDone { return EncodedOp{}, false @@ -94,7 +94,7 @@ func (r *Reader) Decode() (EncodedOp, bool) { r.pc = PC{} continue } - key := Key{ops: r.ops, pc: r.pc.data, version: r.ops.Version()} + key := Key{ops: r.ops, pc: r.pc.data, version: r.ops.version} t := OpType(data[0]) n := t.Size() nrefs := t.NumRefs() @@ -128,7 +128,7 @@ func (r *Reader) Decode() (EncodedOp, bool) { } var op macroOp op.decode(data, refs) - macroData := op.ops.Data()[op.pc.data:] + macroData := op.ops.data[op.pc.data:] if OpType(macroData[0]) != TypeMacro { panic("invalid macro reference") } diff --git a/io/router/pointer_test.go b/io/router/pointer_test.go index 793d7ae4..b1228134 100644 --- a/io/router/pointer_test.go +++ b/io/router/pointer_test.go @@ -754,22 +754,3 @@ func BenchmarkRouterAdd(b *testing.B) { }) } } - -var benchAreaOp areaOp - -func BenchmarkAreaOp_Decode(b *testing.B) { - ops := new(op.Ops) - pointer.Rect(image.Rectangle{Max: image.Pt(100, 100)}).Push(ops).Pop() - for i := 0; i < b.N; i++ { - benchAreaOp.Decode(ops.Internal.Data()) - } -} - -func BenchmarkAreaOp_Hit(b *testing.B) { - ops := new(op.Ops) - pointer.Rect(image.Rectangle{Max: image.Pt(100, 100)}).Push(ops).Pop() - benchAreaOp.Decode(ops.Internal.Data()) - for i := 0; i < b.N; i++ { - benchAreaOp.Hit(f32.Pt(50, 50)) - } -}