cnlohr / rawdrawandroid

Build android apps without any java, entirely in C and Make
MIT License
2.75k stars 197 forks source link

Lower compression rate on APK zip for faster builds #58

Closed DavidVentura closed 1 year ago

DavidVentura commented 1 year ago

In my project I generate a 1.4MB .so file. The measurements take into account the removal of Jarsigner, #57

With both changes, my build goes from 1050ms to 425ms

Oldes commented 1 year ago

I wonder how often do you build your project when you need to save 0.5s?

DavidVentura commented 1 year ago

Well, shorter build times dramatically extend what's possible - it's one of the selling points of rawdraw android already. 250~ms of 425ms are still spent signing the APK. If those could be gone, you'd be looking at a 175ms build cycle, which is fantastic

cnlohr commented 1 year ago

there is no reason not to save 175ms per build cycle!! What PC are you running on though? Normally my compression cycle takes like 10ms.

DavidVentura commented 1 year ago

This is on a

model name      : 12th Gen Intel(R) Core(TM) i5-1240P

And this is what I see in my project:

$ ls -lhrt *.so
-rwxr-xr-x 1 david david 1.4M May 29 17:29 libcnfgtest.so

On -9

$ time zip -9 <libcnfgtest.so >out
  adding: - (deflated 72%)

real    0m0.232s
user    0m0.214s
sys     0m0.005s
$ ls -lhrt out
-rw-rw-r-- 1 david david 379K May 30 18:27 out

vs -4

$ time zip -4 <libcnfgtest.so >out
  adding: - (deflated 70%)

real    0m0.028s
user    0m0.028s
sys     0m0.001s
$ ls -lhrt out
-rw-rw-r-- 1 david david 399K May 30 18:27 out
cnlohr commented 1 year ago

I am ok with this change. If anyone wants to go extreme they can do -9.

I would like it if you could add a comment to the Makefile, but I will accept this with the comment explaining -4 vs -9.

Comment can be very short, like

# We use -4 here for the compression ratio, -9 will make a smaller executable but takes longer to build