Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PKG := github.com/goccy/go-json
PKG := github.com/bytedance/sonic

BIN_DIR := $(CURDIR)/bin
PKGS := $(shell go list ./... | grep -v internal/cmd|grep -v test)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

stdjson "encoding/json"

"github.com/goccy/go-json"
"github.com/bytedance/sonic"
jsoniter "github.com/json-iterator/go"
segmentiojson "github.com/segmentio/encoding/json"
"github.com/wI2L/jettison"
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

gojay "github.com/francoispqt/gojay"
gojson "github.com/goccy/go-json"
gojson "github.com/bytedance/sonic"
jsoniter "github.com/json-iterator/go"
segmentiojson "github.com/segmentio/encoding/json"
fastjson "github.com/valyala/fastjson"
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"

gojay "github.com/francoispqt/gojay"
gojson "github.com/goccy/go-json"
gojson "github.com/bytedance/sonic"
jsoniter "github.com/json-iterator/go"
"github.com/pquerna/ffjson/ffjson"
segmentiojson "github.com/segmentio/encoding/json"
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
github.com/francoispqt/gojay v1.2.13
github.com/goccy/go-json v0.0.0-00010101000000-000000000000
github.com/bytedance/sonic v0.0.0-00010101000000-000000000000
github.com/json-iterator/go v1.1.10
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe
github.com/pquerna/ffjson v0.0.0-20190930134022-aa0246cd15f7
Expand All @@ -19,4 +19,4 @@ require (
github.com/stretchr/testify v1.7.0 // indirect
)

replace github.com/goccy/go-json => ../
replace github.com/bytedance/sonic => ../
2 changes: 1 addition & 1 deletion benchmarks/path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package benchmark
import (
"testing"

gojson "github.com/goccy/go-json"
gojson "github.com/bytedance/sonic"
)

func Benchmark_Decode_SmallStruct_UnmarshalPath_GoJson(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/slow_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"reflect"
"testing"

gojson "github.com/goccy/go-json"
gojson "github.com/bytedance/sonic"
)

// Benchmark decoding from a slow io.Reader that never fills the buffer completely
Expand Down
4 changes: 2 additions & 2 deletions color.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package json
package sonic

import (
"fmt"

"github.com/goccy/go-json/internal/encoder"
"github.com/bytedance/sonic/internal/encoder"
)

type (
Expand Down
4 changes: 2 additions & 2 deletions color_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package json_test
package sonic_test

import (
"testing"

"github.com/goccy/go-json"
json "github.com/bytedance/sonic"
)

func TestColorize(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions decode.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package json
package sonic

import (
"context"
Expand All @@ -7,9 +7,9 @@ import (
"reflect"
"unsafe"

"github.com/goccy/go-json/internal/decoder"
"github.com/goccy/go-json/internal/errors"
"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/decoder"
"github.com/bytedance/sonic/internal/errors"
"github.com/bytedance/sonic/internal/runtime"
)

type Decoder struct {
Expand Down
6 changes: 3 additions & 3 deletions decode_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package json_test
package sonic_test

import (
"bytes"
Expand All @@ -18,7 +18,7 @@ import (
"time"
"unsafe"

"github.com/goccy/go-json"
json "github.com/bytedance/sonic"
)

func Test_Decoder(t *testing.T) {
Expand Down Expand Up @@ -123,7 +123,7 @@ func Test_Decoder(t *testing.T) {
assertEq(t, "map.c", v["c"], 3)
assertEq(t, "map.d", v["d"], 4)
t.Run("nested map", func(t *testing.T) {
// https://github.com/goccy/go-json/issues/8
// https://github.com/bytedance/sonic/issues/8
content := `
{
"a": {
Expand Down
12 changes: 6 additions & 6 deletions encode.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package json
package sonic

import (
"context"
"io"
"os"
"unsafe"

"github.com/goccy/go-json/internal/encoder"
"github.com/goccy/go-json/internal/encoder/vm"
"github.com/goccy/go-json/internal/encoder/vm_color"
"github.com/goccy/go-json/internal/encoder/vm_color_indent"
"github.com/goccy/go-json/internal/encoder/vm_indent"
"github.com/bytedance/sonic/internal/encoder"
"github.com/bytedance/sonic/internal/encoder/vm"
"github.com/bytedance/sonic/internal/encoder/vm_color"
"github.com/bytedance/sonic/internal/encoder/vm_color_indent"
"github.com/bytedance/sonic/internal/encoder/vm_indent"
)

// An Encoder writes JSON values to an output stream.
Expand Down
4 changes: 2 additions & 2 deletions encode_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package json_test
package sonic_test

import (
"bytes"
Expand All @@ -18,7 +18,7 @@ import (
"testing"
"time"

"github.com/goccy/go-json"
json "github.com/bytedance/sonic"
)

type recursiveT struct {
Expand Down
4 changes: 2 additions & 2 deletions error.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package json
package sonic

import (
"github.com/goccy/go-json/internal/errors"
"github.com/bytedance/sonic/internal/errors"
)

// Before Go 1.2, an InvalidUTF8Error was returned by Marshal when
Expand Down
4 changes: 2 additions & 2 deletions export_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package json
package sonic

import (
"github.com/goccy/go-json/internal/errors"
"github.com/bytedance/sonic/internal/errors"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/goccy/go-json
module github.com/bytedance/sonic

go 1.19
2 changes: 1 addition & 1 deletion helper_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package json_test
package sonic_test

import "testing"

Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/generator/vm.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"sort"
"unsafe"

"github.com/goccy/go-json/internal/encoder"
"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/encoder"
"github.com/bytedance/sonic/internal/runtime"
)

func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/decoder/anonymous_field.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package decoder
import (
"unsafe"

"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/runtime"
)

type anonymousFieldDecoder struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/decoder/array.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"unsafe"

"github.com/goccy/go-json/internal/errors"
"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/errors"
"github.com/bytedance/sonic/internal/runtime"
)

type arrayDecoder struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/decoder/bool.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"unsafe"

"github.com/goccy/go-json/internal/errors"
"github.com/bytedance/sonic/internal/errors"
)

type boolDecoder struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/decoder/bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"unsafe"

"github.com/goccy/go-json/internal/errors"
"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/errors"
"github.com/bytedance/sonic/internal/runtime"
)

type bytesDecoder struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/decoder/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"unicode"
"unsafe"

"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/runtime"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion internal/decoder/compile_norace.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package decoder
import (
"unsafe"

"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/runtime"
)

func CompileToGetDecoder(typ *runtime.Type) (Decoder, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/decoder/compile_race.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sync"
"unsafe"

"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/runtime"
)

var decMu sync.RWMutex
Expand Down
2 changes: 1 addition & 1 deletion internal/decoder/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"sync"
"unsafe"

"github.com/goccy/go-json/internal/errors"
"github.com/bytedance/sonic/internal/errors"
)

type RuntimeContext struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/decoder/float.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strconv"
"unsafe"

"github.com/goccy/go-json/internal/errors"
"github.com/bytedance/sonic/internal/errors"
)

type floatDecoder struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/decoder/func.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"unsafe"

"github.com/goccy/go-json/internal/errors"
"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/errors"
"github.com/bytedance/sonic/internal/runtime"
)

type funcDecoder struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/decoder/int.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"reflect"
"unsafe"

"github.com/goccy/go-json/internal/errors"
"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/errors"
"github.com/bytedance/sonic/internal/runtime"
)

type intDecoder struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/decoder/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"reflect"
"unsafe"

"github.com/goccy/go-json/internal/errors"
"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/errors"
"github.com/bytedance/sonic/internal/runtime"
)

type interfaceDecoder struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/decoder/invalid.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"reflect"
"unsafe"

"github.com/goccy/go-json/internal/errors"
"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/errors"
"github.com/bytedance/sonic/internal/runtime"
)

type invalidDecoder struct {
Expand Down
6 changes: 3 additions & 3 deletions internal/decoder/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"reflect"
"unsafe"

"github.com/goccy/go-json/internal/errors"
"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/errors"
"github.com/bytedance/sonic/internal/runtime"
)

type mapDecoder struct {
Expand Down Expand Up @@ -36,7 +36,7 @@ const (
mapMaxElemSize = 128
)

// See detail: https://github.com/goccy/go-json/pull/283
// See detail: https://github.com/bytedance/sonic/pull/283
func canUseAssignFaststrType(key *runtime.Type, value *runtime.Type) bool {
indirectElem := value.Size() > mapMaxElemSize
if indirectElem {
Expand Down
2 changes: 1 addition & 1 deletion internal/decoder/number.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strconv"
"unsafe"

"github.com/goccy/go-json/internal/errors"
"github.com/bytedance/sonic/internal/errors"
)

type numberDecoder struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/decoder/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"reflect"
"strconv"

"github.com/goccy/go-json/internal/errors"
"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/errors"
"github.com/bytedance/sonic/internal/runtime"
)

type PathString string
Expand Down
2 changes: 1 addition & 1 deletion internal/decoder/ptr.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"unsafe"

"github.com/goccy/go-json/internal/runtime"
"github.com/bytedance/sonic/internal/runtime"
)

type ptrDecoder struct {
Expand Down
Loading