About Common Lisp Executable

Asked 2 years ago, Updated 2 years ago, 149 views

The size of the executable is quite large when compiling the following sources in common rep, but would it be possible to reduce it?

 (defun main()
    (format "Hello World!~%")

( sb-ext: save-lisp-and-die "hello-sbcl"
    —toplevel#'main
    —executable t)

The following is the size of the compilation command and the executable created by the compilation.

$sbcl --noinform --no-sysinit --no-userinit --load exec-sbcl.lisp
$ls -l
     157 22507:39 exec-sbcl.lisp; source
44924976 2257:39 hello-sbcl; executable

"Even if you add the option ""compression"" to ""save-lisp-and-die"", it is about 10MB in size."
When I looked it up, I found that the size of the executable file was also increased because the standard library was large, but I didn't know how to deal with it.

Also, the size of the executable file did not change much when I tried it with clozure cl.

Is it possible to reduce the size of the executable with common lisp?

common-lisp sbcl

2022-09-30 19:29

1 Answers

It was in English, but there was a useful conversation.
https://stackoverflow.com/questions/11036070/lisp-binary-size

https://stackoverflow.com/questions/913671/are-there-lisp-native-code-compilers

  • Using commercial processing systems (LispWorks, Allegro CL)
  • In the case of SBCL, the compilation image can be compressed and expanded at runtime to reduce the image size
  • Compile to C language in ECL and create execution format in C compiler as stated in the comment
     


2022-09-30 19:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.