Skip to content

Commit

Permalink
chore: force all optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
liuq19 committed Jun 5, 2024
1 parent d980618 commit 3e288cf
Show file tree
Hide file tree
Showing 2 changed files with 24 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
}

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

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

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

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

type frozenConfig struct {
Config
encoderOpts encoder.Options
Expand Down

0 comments on commit 3e288cf

Please sign in to comment.