Use -opt=1 as the default for hosted targets
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- go, wasm
- Lĩnh vực
- build-system, performance
Hướng nghiên cứu
The issue says the default optimization value is set in main.go and that there is no per-target default. Start by reading that setting and how targets are identified; then compare hosted and bare-metal target behavior. Decide which targets should use -opt=1, including whether wasip1, wasip2 and wasm qualify, and verify the default preserves the stated size and performance tradeoffs.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
TinyGo builds every target with -opt=z unless the user passes -opt. That is the right default for bare metal, where flash is the constraint. Hosted targets run on large out of order CPUs where the upstream gc compiler always optimises for speed, so -opt=z makes TinyGo behave differently from Go on exactly the platforms where users compare the two.
While investigating #5659 I found that at -opt=z LLVM's inline threshold is low enough that even the five instruction ASCII fast path of utf8.DecodeRuneInString is not inlined into its callers. Go always inlines it. Measured on linux/amd64 with TinyGo 0.44.0 and LLVM 23, running TestZip64LargeDirectory/uint32max-1_NoZip64 from archive/zip:
| -opt=z | -opt=1 | |
|---|---|---|
| subtest time | 22.19s | 18.90s |
| test binary size | 4.03 MB | 5.66 MB |
Go runs the same subtest in 6.51s.
Binary size does not always go up. For a hello world using fmt.Println on linux/amd64:
| -opt=z | -opt=1 | |
|---|---|---|
| file size | 1,141,552 | 789,264 |
| text | 164,805 | 71,415 |
At -opt=z the time, fmt, internal/reflectlite and strconv packages contribute about 40 KB of code that is gone at -opt=1. A hello world using println is 536,096 bytes at -opt=z and 539,640 at -opt=1.
Reproduce with:
tinygo test -opt=z -c -o /tmp/zip-z.test archive/zip
tinygo test -opt=1 -c -o /tmp/zip-1.test archive/zip
cd $(go env GOROOT)/src/archive/zip
/tmp/zip-z.test -test.run='^TestZip64LargeDirectory$/^uint32max-1_NoZip64$' -test.v
/tmp/zip-1.test -test.run='^TestZip64LargeDirectory$/^uint32max-1_NoZip64$' -test.v
Today the default is a single value in main.go and there is no per target default. The open questions are which targets count as hosted, in particular whether wasip1, wasip2 and wasm should be included given that wasm users often care about download size.
- Ngôn ngữ chính
- Go
- Star
- 17.8k
- Fork
- 1.1k
- Merge trung bình
- 1 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 380
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tinygo-org/tinygo
-
avr: SPI Mode2 runs as mode 1Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
tinygo-org/tinygo#6727 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
tinygo-org/tinygo#6711 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Builds are not reproducible: cgo snippet paths in debug infoCó thể đã có người làm @tridev-tej đã nhận 1 ngày trước. Đang mởenhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
tinygo-org/tinygo#6619 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Fix the targets that tinygo build -target rejectsCó thể đã có người làm @narguis đã nhận 2 ngày trước. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
tinygo-org/tinygo#6617 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
tinygo-org/tinygo#6312 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của tinygo-org/tinygo
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
sresarehumantoo/cc-artex#456 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ollama/ollama#20021 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
factory:subtask
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
release
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
github/gh-aw-mcpg#17603 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
bboerst/stratum-work#351 ·
Maintainer thường phản hồi trong vòng 1 ngày