[FR]: Faster build speed with Gradle properties + jemalloc

Đang mở
#1,510 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
android, kotlin

Hướng nghiên cứu

Bắt đầu bằng việc xem xét các bài kiểm thử hiệu năng và những thay đổi trong pull request #1492, sau đó so sánh các thiết lập JVM, jemalloc và thuộc tính Gradle được đề xuất cho các bản build Android cục bộ và GitHub CI. Công việc được xem là hoàn tất khi các thiết lập đã được thống nhất, được ghi lại trong cấu hình dự án và tác động của chúng đến tốc độ build và bộ nhớ đã được đo lường.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement
Is there an existing issue for this?
  • I have searched the existing issues
Describe the problem

I was talking about the settings used in this project with @liutikas and some others. It was speculated that it was possible to reduce the JVM heap size the project uses and also attain a faster build speed.

Describe the solution

I propose we do this by:

  • Using jemalloc as a malloc replacement - most projects get about 10% memory freed up, though no build speed impact
  • Use G1GC - I've seen this work better for Android projects that use JDK 19 or later, or if they're simply having some memory contention/pressure issues with running the project on resource constrained machines.
  • SoftRefLRUPolicy - This is defaulted to 1000 which at current settings would take almost 2 hours to release any soft ref
  • ReservedCodeCacheSize - Increasing this from the default allows the project to preallocate the codecache and not have to spend time growing it during a build
  • MetaspaceSize - From my research about Metaspace, Android Gradle builds benefit the most when MaxMetaspace is allowed to be unlimited (the JVM default) and MetaspaceSize set to 512MB or 1GB instead of the default 20MB. This is because MaxMetaspace is a constraint on both Metapsace and ClassPointers, the latter of which defaults to 1GB.
  • Min & max heap - Experimentation required to see what the optimal heap size for the project would be for both local development and GitHub CI.
Additional context

I already did the performance testing and changes, I'm just filling this out so the change can be considered and reviewed.

Code of Conduct
  • I agree to follow this project's Code of Conduct
Ngôn ngữ chính
Kotlin
Star
22.1k
Fork
4.7k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của android/nowinandroid

Tất cả issue của android/nowinandroid

Issue tương tự

Thêm issue về Kotlin

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.