Reduce memory usage at compile time

This commit is contained in:
Masaaki Goshima 2021-03-18 16:17:14 +09:00
parent 4db967f28d
commit 969dfcec31
4 changed files with 19 additions and 1 deletions

View File

@ -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"

View File

@ -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)

View File

@ -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)

View File

@ -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)