EMLX.CompileCache (emlx v0.4.2)

Copy Markdown View Source

Bounded cache of native_compile/3 eval closures.

EMLX.__compile__/4 stores one closure per {fun, templates, hooks, device} so repeated Nx.Defn.jit/2 of the same call site skips retrace. Unbounded unless the host sets:

config :emlx, EMLX.CompileCache,
  max_items: 1024,
  ttl: :timer.minutes(30)

Both default to :infinity. Overflow is FIFO by insert index. TTL is from insert time and is swept by this process (send_after(self(), :expire_entries, div(ttl, 2))), not on cache reads. A sweeper that is already running re-reads app env each tick; if TTL is :infinity at start, nothing is scheduled until the process restarts.

The structural program table :emlx_native_dispatch_cache is shared across call sites and is not bounded by these knobs.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.