Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use raw (unsafe) memory clear on reset. #16

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ require (
github.com/koykov/byteptr v1.0.0
github.com/koykov/fastconv v1.0.2
github.com/koykov/indirect v1.0.0
github.com/koykov/openrt v0.0.0-20240220213454-7b5b4e8c30a5
)

require github.com/koykov/byteseq v0.0.0-20230330194259-68973f3b765a // indirect
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -10,3 +10,5 @@ github.com/koykov/fastconv v1.0.2 h1:csOWpctD9OcpkfI07LEtqtolc4TT8Y6QG3zQvkTmhrQ
github.com/koykov/fastconv v1.0.2/go.mod h1:9jOx5KRGe4UKHxGiDw5Yrp/qrqn2cRwH3xvFjqqCE3c=
github.com/koykov/indirect v1.0.0 h1:3kog1xvVUEB2142K2/AZRhnOKN2N8KNahHHkE+KT7ec=
github.com/koykov/indirect v1.0.0/go.mod h1:2qWC0hrIHIexlKaqPA0VWEa0s2V/qxxNJv7XPncnh2I=
github.com/koykov/openrt v0.0.0-20240220213454-7b5b4e8c30a5 h1:Gf4EYzitGI5RjjRKT2fhYJcGuo9g6HRM4jvCO4KmmlA=
github.com/koykov/openrt v0.0.0-20240220213454-7b5b4e8c30a5/go.mod h1:y8Xa99HTBmthCilUUW36IZJd5SP9Rb+W8S9CJaauyU8=
7 changes: 5 additions & 2 deletions vector.go
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ import (

"github.com/koykov/bitset"
"github.com/koykov/bytealg"
"github.com/koykov/openrt"
)

// Vector parser object.
@@ -240,7 +241,7 @@ func (vec *Vector) getNode(depth int) (node *Node, idx int) {
if vec.nodeL < n {
_ = vec.nodes[n-1]
node = &vec.nodes[vec.nodeL]
node.Reset()
// node.Reset()
} else {
vec.nodes = append(vec.nodes, Node{typ: TypeUnk})
n++
@@ -279,7 +280,9 @@ func (vec *Vector) Reset() {
if vec.nodeL == 0 {
return
}
_ = vec.nodes[vec.nodeL-1]
openrt.MemclrUnsafe(unsafe.Pointer(&vec.nodes[0]), vec.nodeL*nodeSize)
vec.nodeL = 0

vec.buf, vec.src = vec.buf[:0], nil
vec.bufSS = vec.bufSS[:0]
vec.addr, vec.nodeL, vec.errOff = 0, 0, 0