Git Product home page Git Product logo

luatex-lua-module-cache-manager's Introduction

luatex-lua-module-cache-manager

Lua module cache manager for LuaTeX and cousins

What is this?

lua-module-cache-manager.lua is a Lua initialization script for LuaTeX and cousins that manages a cache for Lua modules. Lua modules are typically loaded from source. This implies parsing them and other steps, which incurs some cost. Lua implementations –including the ones bundled in LuaTeX and LuaJITTeX– internally turn the source code into something called 'bytecode'. Loading bytecode would thus be faster than loading source code, as it would skip a few steps. This system approaches the problem by caching all Lua modules loaded from source as bytecode in a single file that works similarly to LaTeX's aux file.

Does it really help?

A bit, ja, although I haven't properly benchmarked it. It can be more than half a second in my machine, which is nice for small documents that are compiled often.

How to use it?

LuaTeX engines understand the --lua option. Pass the script path as its argument:

$  lualatex --interaction=nonstopmode --lua=lua-module-cache-manager.lua -- main.tex

Keep in mind, though, that the Lua initialization script is run every time. You should consider byte-compiling it itself; the command depends on the engine in use:

  • LuaTeX:

    $  texluac -s -o lua-module-cache-manager.texluabc -- lua-module-cache-manager.lua
    
  • LuaJITTeX:

    $  texluajitc -b lua-module-cache-manager.lua lua-module-cache-manager.texluabc
    

Then:

$  lualatex --interaction=nonstopmode --lua=lua-module-cache-manager.texluabc -- main.tex

Lua initialization scripts have access to the arguments with which the LuaTeX engine was invoked. This script handles a few options:

option type description
--lua-module-cache-mode=b|t optional Cache format:
tASCII Lua source
bLua bytecode. Should be a bit faster
--lua-module-cache-file=/path/to/the/cache/file.extension optional Its default value depends on the cache format:
tlua-module-cache.lua
blua-module-cache.texluabc
--lua-module-cache-manager-verbose optional Whether merely informational logging messages should be outputted to the terminal (and not only to the log file).

Pass them to the script as if they were normal LuaTeX options:

$  lualatex --interaction=nonstopmode --lua=lua-module-cache-manager.lua --lua-module-cache-file=main.lmc --lua-module-cache-mode=b --lua-module-cache-manager-verbose -- main.tex

Requirements

  • A "new enough" version of LuaTeX/LuaJITTeX.

It has been tested on: - LuaTeX 0.80, revision 5238 by TeX Live 2015 on Windows. - LuaJITTeX 0.80, revision 5238 by TeX Live 2015 on Windows. - LuaTeX 0.95 by TeX Live 2016 on Windows. - LuaJITTeX 0.95 by TeX Live 2016 on Windows.

  • A recent enough installation of the LuaLaTeX infrastructure.

In particular, the LaTeX kernel should include LuaTeX support and the luatexbase package should reflect this change. This all panned out around October 2015. See issue #1 for a description of the problem you would face in case you didn't meet this requirement and a workaround by Henry So.

luatex-lua-module-cache-manager's People

Watchers

Deepak Jois avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.