Closed h4ckee closed 4 years ago
Being written in Go, micro is statically compiled. All libraries called are compiled in and bundled into the generated executable. If this really bothers you, you can try compiling with the -linkshared flag (go build -linkshared).
13MB is pretty small for a go program.
For linux, there are both static and non-static versions available. Both of them are roughly the same size, but strangely, the static version is very slightly smaller than the non-static one. I'm not sure how that is possible!
Nice wordplay. Micro bundles a lot into a single binary file. Including files that'd normally be saved elsewhere on the system. For instance all syntax files, colorschemes and documentation is saved in the binary. And these files are a big part of what makes micro so user-friendly.
As I understand it @zyedidia goal here is to make micro easier to share and install. Being able to be downloaded as a single binary file.
Micro, and Go programs in general, will always quite large unfortunately. Micro packs a lot of information into the binary including the runtime files, a terminfo database for recognizing terminals, and a significant portion of the go stdlib, and other libraries (especially space consuming is the http library for the plugin manager, various text encoding/processing utilities, and the Lua VM for running plugins). These Go libraries are really the things that cause the binary to be so large. I'm afraid there isn't much that can be done on my end to solve this. Maybe in the future Go will be updated to produce smaller binaries but that seems unlikely.
You may want to try using upx to compress the micro executable. In the past, I have found that the micro binary can usually be compressed down to about 4mb using UPX. This isn't done automatically for released binaries because it is possible that the UPX compression could cause an issue on some platforms (when I was investigating this about 3 years ago, the macOS binary did not work after compression, but that bug may have since been fixed).
Seeing as builds are automated, could it be possible to add UPX compressed binaries to the list of downloadable binaries?
@LevitatingBusinessMan One downside of UPX is that it tends to produce false positives in antivirus programs. It will also impact startup times negatively (just a bit, but enough to be noticeable on ARM devices). Lastly, compressing an UPX-packed binary won't reduce its size any further, so you might as well just distribute a binary in a ZIP archive directly.
Thanks @zyedidia, everybody. I like the editor, and suppose it one of the best in usability and user-friendliness. Wish the project prosperity. BR, Sergey.
Hello Zyedidia . How come to be micro editor become mAcro editor being bigger and bigger every release, its size is 13Mb which is bigger than my FreeBSD kernel, PSB:
I believe it should remain slim and compact while retaining its functionality. Is it possible to remove all unneded stuff during compilation, like all themes except just one, some help texts (like copypaste) etc.? Best regards, Sergey.
$ micro -version Version: 2.0.2 Commit hash: c51f849 Compiled on February 26, 2020
Commit hash: c51f849 OS: