Micro: Micro become macro editor.

Created on 4 Mar 2020  路  7Comments  路  Source: zyedidia/micro

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:

> ll /usr/local/bin/micro
-r-xr-xr-x  1 root  wheel  uarch 13193216  2 屑邪褉褌邪 12:06 /usr/local/bin/micro
> ll /boot/kernel/kernel
-r-xr-xr-x  1 root  wheel  uarch 11765168 17 芯泻褌.  23:45 /boot/kernel/kernel

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:

uname -a
FreeBSD KPECT 12.0-STABLE FreeBSD 12.0-STABLE KPECT amd64
Terminal:
urxvt-unicode

Most helpful comment

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.

All 7 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rizal72 picture rizal72  路  3Comments

handicraftsman picture handicraftsman  路  4Comments

johnmbaughman picture johnmbaughman  路  3Comments

Bigguy34 picture Bigguy34  路  3Comments

utkarsh2102 picture utkarsh2102  路  3Comments