core icon indicating copy to clipboard operation
core copied to clipboard

Reduce binary sizes

Open ddkwork opened this issue 1 year ago • 34 comments

How to optimize the files built on the Windows platform if they are too large? 1703995032447.png

ddkwork avatar Dec 31 '23 03:12 ddkwork

i was tried use "goki build -v -t windows/amd64" or "go build ."

ddkwork avatar Dec 31 '23 03:12 ddkwork

The binaries are definitely too big, and we will work on reducing binary sizes soon.

kkoreilly avatar Dec 31 '23 04:12 kkoreilly

In the meantime, simply compressing the binaries (eg: gzip sys.exe) reduces the binary size significantly (about 4x for me on Windows). You can also try more powerful compression tools like brotli.

kkoreilly avatar Dec 31 '23 04:12 kkoreilly

Though you do have to uncompress them on the target system, it can help when deploying them.

kkoreilly avatar Dec 31 '23 04:12 kkoreilly

Though you do have to uncompress them on the target system, it can help when deploying them.

okay,thx you.

ddkwork avatar Dec 31 '23 04:12 ddkwork

I have cut binary sizes in half in the current version of gi in development by reducing dependencies and cleaning up code. You will not see these changes until I do a release cycle, which will not happen for a few days due to other ongoing changes. I will keep this issue open because there are still many more changes I want to make to further reduce binary sizes.

kkoreilly avatar Jan 02 '24 18:01 kkoreilly

I have cut binary sizes in half in the current version of gi in development by reducing dependencies and cleaning up code. You will not see these changes until I do a release cycle, which will not happen for a few days due to other ongoing changes. I will keep this issue open because there are still many more changes I want to make to further reduce binary sizes.

OKay,but i found the gide's code need update with this change.

ddkwork avatar Jan 02 '24 22:01 ddkwork

I fixed the error in gide.

kkoreilly avatar Jan 03 '24 06:01 kkoreilly

I fixed the error in gide.

After this period of submission, the Android program starts with a black screen or no controls, and the test is files or task manager repository

ddkwork avatar Jan 03 '24 10:01 ddkwork

I am aware of this issue and am working to resolve it as soon as possible.

kkoreilly avatar Jan 03 '24 18:01 kkoreilly

I fixed the Android app issue in the latest version of gi (go get goki.dev/gi/v2@main).

kkoreilly avatar Jan 07 '24 20:01 kkoreilly

Also, I figured out a way to get rid of gimain, so you can remove the gimain.Run from all of your code.

kkoreilly avatar Jan 08 '24 00:01 kkoreilly

Also, I figured out a way to get rid of gimain, so you can remove the gimain.Run from all of your code.

cool for you, i will try all.

ddkwork avatar Jan 08 '24 05:01 ddkwork

I fixed the Android app issue in the latest version of gi (go get goki.dev/gi/v2@main).

The test found that the two-finger operation DPI scaling did not return to normal

ddkwork avatar Jan 08 '24 06:01 ddkwork

I am aware of that and planning to fix it soon.

kkoreilly avatar Jan 08 '24 06:01 kkoreilly

I want to keep this open because there are still some binary size issues that I need to resolve.

kkoreilly avatar Jan 25 '24 15:01 kkoreilly

I want to keep this open because there are still some binary size issues that I need to resolve.

okay

ddkwork avatar Jan 25 '24 15:01 ddkwork

The basic Cogent Core hello example is around twice as big, which is because Cogent Core comes with many more features and widgets. As I stated above, we are continuing to work on reducing binary sizes, and we should end up relatively close to gio's size after we make more optimizations soon.

kkoreilly avatar Feb 09 '24 02:02 kkoreilly

I made further optimizations that reduce the binary size of the basic example by 1.5 MB, and I will continue to work on reducing binary sizes further.

kkoreilly avatar Feb 12 '24 00:02 kkoreilly

I made further optimizations that reduce the binary size of the basic example by 1.5 MB, and I will continue to work on reducing binary sizes further.

I found a detached cgo implementation with a small compilation speed and binary size, and I saw if there was anything to learn, go mod download github.com/hajimehoshi/ebiten/v2@e8cdf885c05cf2395b1935d7f23c9295dece1f0b

ddkwork avatar Feb 25 '24 12:02 ddkwork

{317207F5-A9AE-4276-810E-CA5F6177E3C4}

ddkwork avatar Feb 25 '24 12:02 ddkwork

{1F93CFA0-FECE-41e4-ABCE-487387C28D68} I have to study this carefully, a long time ago I used fyne packaging font to support Chinese display after the binary volume is very large, wails not to mention, unison is also large, slow compilation, he compiled Chinese display in 1 second and only more than 10MB, this feature must be mined C:\Users\Admin\Desktop\v2.7.0-alpha.9.0.20240225111819-e8cdf885c05c\github.com\hajimehoshi\ebiten\[email protected]\examples\font

ddkwork avatar Feb 25 '24 12:02 ddkwork

screenshots

ddkwork avatar Feb 25 '24 12:02 ddkwork

I don't think the cgo is the main issue, although we may try https://github.com/ebitengine/purego at some point to make cross-compilation easier. The main remaining binary size issues I am aware of and planning to fix are the enumgens, fonts, and icons, which together make up a sizable percentage of the remaining binary size. I will also work on further reducing dependencies if possible.

kkoreilly avatar Feb 25 '24 16:02 kkoreilly

ok

---Original--- From: @.> Date: Mon, Feb 26, 2024 00:40 AM To: @.>; Cc: @.>;"State @.>; Subject: Re: [cogentcore/core] Reduce binary sizes (Issue #733)

I don't think the cgo is the main issue, although we may try https://github.com/ebitengine/purego at some point to make cross-compilation easier. The main remaining binary size issues I am aware of and planning to fix are the enumgens, fonts, and icons, which together make up a sizable percentage of the remaining binary size. I will also work on further reducing dependencies if possible.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

ddkwork avatar Feb 25 '24 19:02 ddkwork

sorry for small notice, but with upx (dnf install upx) it is only 4.3 MB that is nice ......... Screenshot from 2024-06-17 20-14-00

MatejMagat305 avatar Jun 17 '24 18:06 MatejMagat305

Yep, upx is definitely an effective way to reduce binary sizes, although at some cost. I am considering potential further icon and spelling optimizations to reduce binary sizes more, and I am also planning to work on reducing the size of some of the core code.

kkoreilly avatar Jun 17 '24 18:06 kkoreilly

Also, if #974 is successful, that should drastically reduce web binary sizes.

kkoreilly avatar Jun 17 '24 18:06 kkoreilly

I restructured the way instance variables work in typegen such that widgets are now only compiled into the app if they are used, which generally reduces binary sizes by several hundred kilobytes (the demo was reduced by 663.8 kb) (see b1b3f62).

Also, binary sizes are currently temporarily inflated due to large spelling files being embedded into apps, which we are going to fix soon with #711.

kkoreilly avatar Jun 27 '24 13:06 kkoreilly

We improved the storage of the spelling file in #1001, which reduced binary sizes by 14.0 MB for apps that use text editors! I am also working on icon changes that will reduce binary sizes by 1-2 MB for all apps.

kkoreilly avatar Jul 05 '24 17:07 kkoreilly