-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: ccxt oom killed on compilation #73365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
cc @golang/compiler |
Is https://pkg.go.dev/github.com/ccxt/ccxt/go/v4 the problematic package? I count "only" ~670k lines of code in that package (not millions), but that is still a lot for a single package. :) The package does build successfully for me, but it takes ~2min and cmd/compile has a peak memory usage of ~10GB. |
CPU profile: https://pprof.host/mw4g/flamegraph Not much stands out as odd to me here. Perhaps other compiler folks notice something. The one odd thing is that this compilation took ~120s wall time and used ~173s CPU time, which isn't very parallel. The SSA backend is concurrent, so I'm a bit surprised it didn't make better use of concurrency. |
FWIW, even if we fix this to use less memory, I recommend you split this package up. This package contains ~1500 exported types and functions. Most users are going to browse documentation on https://pkg.go.dev/github.com/ccxt/ccxt/go/v4, which is nigh-unusable. It took me ~10s just to scroll through the index as quickly as I could! IMO, a more natural design in Go would be to use one package per exchange, and then users only import the packages for the exchanges they use. I think this would be nicer to use as a user plus it would almost certainly fix your build time issues, as each binary would only need to build the packages that are actually used. i.e., in https://github.com/ccxt/ccxt?tab=readme-ov-file#go-1, instead of import (
"github.com/ccxt/ccxt/go/v4"
)
func main() {
exchange := ccxt.NewBinance(...) You'd have import (
"github.com/ccxt/ccxt/go/v5/binance"
)
func main() {
exchange := binance.NewExchange(...) |
@prattmic Thanks for your answer.
Sorry that was a rough estimation I did not count them 😅
I agree but we have some limitations since most of the code is transpiled from TS and not natively implemented. Nonetheless I appreciate your input and it will be taken into consideration |
Go version
go version 1.24.0 darwin/arm64 / go version go1.23.7 linux/amd64 / etc
Output of
go env
in your module/workspace:What did you do?
CCXT is a crypto trading SDK that supports more than 100+ exchanges making it a pretty big package (hundreds of files and millions of loc).
We have recently released a GO version of the package, but the reports of users not able to compile it due to an OOM error are stacking up.
We have tried different go versions (1.22/23/24) and OSes but the problem pops up in all of them apparently.
Related issues:
What did you see happen?
The build hangs indefinitely, or the process gets OOM-killed.
What did you expect to see?
The build succeeded in a timely manner
The text was updated successfully, but these errors were encountered: