-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/mobile: gomobile bind slow compilation #54770
Comments
It might be possible that the slow compilation is caused by cgo. Have you tried rebuilding the project? What's the compilation time? |
cc @hyangah |
@changkun The time is the same for every compilation. It seems that cgo doesn't use any cache and rebuild everything every time. The same issue (long time compilation of |
I think https://go-review.googlesource.com/c/mobile/+/426274 is currently speeding up the compilation process. Can this patch mitigate this issue? |
I'll work on the same thing for iOS in another CL. |
Change https://go.dev/cl/437035 mentions this issue: |
This CL cleans up the code using gobind by these fixes: - Run the gobind command for each platform, instead of each target (= platform + arch). - Run the gobind command in parallel with errgroup.Group. This CL doesn't improve performance significantly, but should improve readability by splitting the long for-range loop. Updates golang/go#54770 Change-Id: I881810b95db0fa6a6d17982154591af467f1ebfe Reviewed-on: https://go-review.googlesource.com/c/mobile/+/437035 Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Changkun Ou <[email protected]> Auto-Submit: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Hajime Hoshi <[email protected]>
Change https://go.dev/cl/442195 mentions this issue: |
This change makes building archive files for iOS concurrent for each architecture and each platform. The strategy is basically the same as my previous CL for Android: https://go.dev/cl/426274. This change also specifies GOMODCACHE explicitly when executing Go commands so that the existing cache is always used. The default GOMODCACHE is $GOPATH/pkg/mod, and this path varies when a temporary GOPATH is specified, which results in cold cache. Before this change (on my MacBook Pro 2020): $ time go run ./cmd/gomobile/ bind -target ios ./example/bind/hello/ real 0m23.274s user 0m15.751s sys 0m10.469s After this change: $ time go run ./cmd/gomobile/ bind -target ios ./example/bind/hello/ real 0m8.059s user 0m13.763s sys 0m9.004s Updates golang/go#37902 Updates golang/go#54770 Change-Id: Iaeb077b58c22ab63d28f78972a0af76660883a05 Reviewed-on: https://go-review.googlesource.com/c/mobile/+/442195 Reviewed-by: Changkun Ou <[email protected]> Run-TryBot: Hajime Hoshi <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
time gomobile bind -target=ios golang.org/x/mobile/example/bind/hello
30,61s user 16,19s system 118% cpu 39,495 total
What did you expect to see?
Faster compilation
What did you see instead?
30 s compilation time on default empty project. Working project compiles 2,5 minutes
The text was updated successfully, but these errors were encountered: