Monday  8 July 2024


Execution-time CCL between Clisp and SBCL
=========================================

In a previous post [1] I compared the execution time of my static site
builder of a version compiled in Clisp with a version compiled in
SBCL.

Today, I also compiled the static site builder in Clozure Common Lisp,
or, abbreviated, CCL. This is another awesome open source Common Lisp
implementation, just like Clisp and SBCL.

Vimwiki diary directory
-----------------------
The static site builder builds my website, http://box.matto.nl/

Many years ago I started using a Vimwiki for the content management.
This format is still used, only I now use Emacs for it.

To create the posts, I used to use the Vimwiki diary.

Each post begins as a file with a filename in the format `YYYY-MM-DD.md',
stored in the `~/vimwiki/diary' directory.

* The format is Markdown
* The first line is an Markdown H1 header which becomes the title
* The second line contains the tags, separated by colons, like `:tag1:tag2:'

The format of the first line with the title is:

   # This is the title

There are also some static pages. For this, I have created a sub directory
'~/vimwiki/diary/static'.

Static site builder
-------------------
The static site builder that I have build, starts with reading the
first two lines of the Markdown files, to collect the meta-data:
the filename, title, date and tags.

From this, the page with all the tags is created, as well a page for each
individual tag, listing all the pages that have that specific tag. The page
with all the posts and the page with the recent posts are also created using
the collection of meta-data.

After this, all the Markdown files are processed individually, turning
the Markdown into HTML.

The static site builder also creates the static pages, like the
about-page, the now-page, the links-page, and so on. The content for
these pages are written in Markdown files in the `static' sub
directory.

First, a shell script creates the contents for the links file, using
the GNU recutils for this. Its output is again a file in the static
directory.

After this is done, the builder builds the RSS feed. Then everything
is ready and the builder stops.

One Common Lisp package, three times compiled
---------------------------------------------
I wrote the static site builder in Clisp, and build the website with it.
I used a FreeBSD jail for this.

Then I copied the source code to a FreeBSD jail that runs SBCL.
After some minor adjustments, the code compiled fine in SBCL.

Today I created a third FreeBSD and installed CCL in it.
Again I copied the source code of the static site builder in it,
and compiled it, this time using CCL.

The end result is that there are now three almost identical FreeBSD
jails, the only difference is that each has a different Common Lisp
installed. The three jails run on the same system, and all three
are a ZFS clone from the same snapshot of a base jail.

Each jail has an executable with the compiled static site builder.

Differences in execution time
-----------------------------
Here are the execution times:

* Clisp: 48 seconds
* CCL:   12 seconds
* SBCL:   2 seconds

 (Actually, SBCL took 2.2 seconds, for the other two the tenths of
 seconds are not significant, of course.)

The time is measured using the `time' utility, like

   time ./static-site-builder

Of course, this is just an simple comparison from a simple
application, build without any performance tuning.
I consider myself a Lisp rookie, without any deep knowledge on Lisp
and without any professional Lisp coding experience.

The compiled programs are just the result of a simple compilation
command,  like, for example for CCL:

   (ccl:save-application "/home/matto/static-site-builder"
       :toplevel-function #'main
       :prepend-kernel t)

Apart from installing Quicklisp and compiling the static site builder,
I haven't done anything yet with CCL.

There is still a big lot to explore and to learn.


   Common Lisp is a rabbit hole that is simple to fall into,
   and once inside, it's difficult to escape from, because
   there's so much to discover...


Open source is awesome
----------------------
It is wonderful that there are several distinguished open source Common Lisp
implementations.  Each has a long history.


Happy Lisping!


[1]: gopher://box.matto.nl/0/performance-difference-between-clisp-and-sbcl.txt


Last edited: $Date: 2024/07/08 20:27:36 $