Skip to content

Commit

Permalink
opt: force decoder opt
Browse files Browse the repository at this point in the history
  • Loading branch information
liuq19 committed Jul 16, 2024
1 parent 456a3b9 commit de824ea
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
23 changes: 15 additions & 8 deletions internal/decoder/api/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,23 @@
package api

import (
`reflect`

`github.com/bytedance/sonic/internal/native`
`github.com/bytedance/sonic/internal/native/types`
`github.com/bytedance/sonic/internal/decoder/consts`
`github.com/bytedance/sonic/internal/decoder/errors`
`github.com/bytedance/sonic/internal/rt`
`github.com/bytedance/sonic/option`
"reflect"

"github.com/bytedance/sonic/internal/decoder/consts"
"github.com/bytedance/sonic/internal/decoder/errors"
"github.com/bytedance/sonic/internal/decoder/optdec"
"github.com/bytedance/sonic/internal/native"
"github.com/bytedance/sonic/internal/native/types"
"github.com/bytedance/sonic/internal/rt"
"github.com/bytedance/sonic/option"
)

func ForceAllOpt() {
decodeImpl = optdec.Decode
pretouchImpl = optdec.Pretouch
rt.EnbaleFastMap = true

Check failure on line 34 in internal/decoder/api/decoder.go

View workflow job for this annotation

GitHub Actions / build (1.22.x)

undefined: rt.EnbaleFastMap

Check failure on line 34 in internal/decoder/api/decoder.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

undefined: rt.EnbaleFastMap

Check failure on line 34 in internal/decoder/api/decoder.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

undefined: rt.EnbaleFastMap

Check failure on line 34 in internal/decoder/api/decoder.go

View workflow job for this annotation

GitHub Actions / build (1.17.x)

undefined: rt.EnbaleFastMap

Check failure on line 34 in internal/decoder/api/decoder.go

View workflow job for this annotation

GitHub Actions / build (1.18.x)

undefined: rt.EnbaleFastMap

Check failure on line 34 in internal/decoder/api/decoder.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

undefined: rt.EnbaleFastMap
}

const (
_F_allow_control = consts.F_allow_control
_F_copy_string = consts.F_copy_string
Expand Down
7 changes: 7 additions & 0 deletions sonic.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,17 @@ import (

`github.com/bytedance/sonic/decoder`
`github.com/bytedance/sonic/encoder`
dec `github.com/bytedance/sonic/internal/decoder/api`

`github.com/bytedance/sonic/option`
`github.com/bytedance/sonic/internal/rt`
)

func init() {
dec.ForceAllOpt()
println("Warning: enable all optimize here, only used in test now")
}

type frozenConfig struct {
Config
encoderOpts encoder.Options
Expand Down

0 comments on commit de824ea

Please sign in to comment.