forked from mirror/go-json
Reduce memory usage at compile time
This commit is contained in:
parent
4db967f28d
commit
969dfcec31
|
@ -7,7 +7,7 @@ services:
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
memory: 1200M
|
memory: 600M
|
||||||
working_dir: /go/src/go-json
|
working_dir: /go/src/go-json
|
||||||
command: |
|
command: |
|
||||||
sh -c "go test -c . && ls go-json.test"
|
sh -c "go test -c . && ls go-json.test"
|
||||||
|
|
|
@ -10,6 +10,12 @@ import (
|
||||||
|
|
||||||
"github.com/goccy/go-json/internal/encoder"
|
"github.com/goccy/go-json/internal/encoder"
|
||||||
"github.com/goccy/go-json/internal/runtime"
|
"github.com/goccy/go-json/internal/runtime"
|
||||||
|
|
||||||
|
// HACK: compile order
|
||||||
|
// `vm`, `vm_escaped`, `vm_indent`, `vm_escaped_indent` packages uses a lot of memory to compile,
|
||||||
|
// so forcibly make dependencies and avoid compiling in concurrent.
|
||||||
|
// dependency order: vm => vm_escaped => vm_indent => vm_escaped_indent
|
||||||
|
_ "github.com/goccy/go-json/internal/encoder/vm_escaped"
|
||||||
)
|
)
|
||||||
|
|
||||||
const uintptrSize = 4 << (^uintptr(0) >> 63)
|
const uintptrSize = 4 << (^uintptr(0) >> 63)
|
||||||
|
|
|
@ -10,6 +10,12 @@ import (
|
||||||
|
|
||||||
"github.com/goccy/go-json/internal/encoder"
|
"github.com/goccy/go-json/internal/encoder"
|
||||||
"github.com/goccy/go-json/internal/runtime"
|
"github.com/goccy/go-json/internal/runtime"
|
||||||
|
|
||||||
|
// HACK: compile order
|
||||||
|
// `vm`, `vm_escaped`, `vm_indent`, `vm_escaped_indent` packages uses a lot of memory to compile,
|
||||||
|
// so forcibly make dependencies and avoid compiling in concurrent.
|
||||||
|
// dependency order: vm => vm_escaped => vm_indent => vm_escaped_indent
|
||||||
|
_ "github.com/goccy/go-json/internal/encoder/vm_indent"
|
||||||
)
|
)
|
||||||
|
|
||||||
const uintptrSize = 4 << (^uintptr(0) >> 63)
|
const uintptrSize = 4 << (^uintptr(0) >> 63)
|
||||||
|
|
|
@ -11,6 +11,12 @@ import (
|
||||||
|
|
||||||
"github.com/goccy/go-json/internal/encoder"
|
"github.com/goccy/go-json/internal/encoder"
|
||||||
"github.com/goccy/go-json/internal/runtime"
|
"github.com/goccy/go-json/internal/runtime"
|
||||||
|
|
||||||
|
// HACK: compile order
|
||||||
|
// `vm`, `vm_escaped`, `vm_indent`, `vm_escaped_indent` packages uses a lot of memory to compile,
|
||||||
|
// so forcibly make dependencies and avoid compiling in concurrent.
|
||||||
|
// dependency order: vm => vm_escaped => vm_indent => vm_escaped_indent
|
||||||
|
_ "github.com/goccy/go-json/internal/encoder/vm_escaped_indent"
|
||||||
)
|
)
|
||||||
|
|
||||||
const uintptrSize = 4 << (^uintptr(0) >> 63)
|
const uintptrSize = 4 << (^uintptr(0) >> 63)
|
||||||
|
|
Loading…
Reference in New Issue