Tuesday, February 18, 2020

Custom built SBCL and using spaCy and TensorFlow in Common Lisp

Here are some of my of my recent notes that might save you some time, or teach you a new trick.

I have had good results using the py4cl library if I wrap API calls to TensorFlow or spaCy in a short Python library that calls Python libraries and returns results in simple types like strings and dictionaries. I just committed a complete example (Python library and Common Lisp client code) to the public repo for my book Loving Common Lisp, or the Savvy Programmer's Secret Weapon that will be added to the next edition of my book. Here is a link to the subdirectory with this new example in my repo: https://github.com/mark-watson/loving-common-lisp/tree/master/src/spacy

I frequently make standalone executable programs using SBCL and I just noticed a great tip from Zach Beane for compressing the size of standalone executables. Start with rebuilding SBCL from source to add the compression option; get the source code and:

./make.sh --with-sb-thread --with-sb-core-compression
sh install.sh

When I now build my KGCreator application with:

(sb-ext:save-lisp-and-die "KGcreator" :toplevel #'kgcreator :executable t :compression t)

then the size of the standalone executable is reduced from 93MB to 19MB. I don't notice any extra startup time which is important for command line utilities.

No comments:

Post a Comment