Skip to content

Super-speed caching for static module directory trees #629

@smprather

Description

@smprather

Hi @xdelaruelle --

After a lot of back-n-forth with my GPT-friend, I would like to propose a new opt-in feature: a user commitment to a static module dir tree (no virtual modules, .modulerc dynamic behaviour changes, etc), which gets you big performance gains (>100x). As you know by now, I have a script that generates 15k (15k today, more coming soon) modules with no dynamic features. And no problem taking an arbitrarily long up-front cache build time.

Do you agree this is something you can accept? The basic contract is that user gives up dynamic features for big performance.

We can talk about what to do if the contract is broken. Fallback to old? Hard fail? User chooses?

In the next comment, I'll copy/paste the full chat log for more details.

Example config names GPT threw out.

  1. Add an explicit opt-in mode
     Something like a config knob:
  - static_cache
  - frozen_modulepath
  - trust_cache_fully

Example of what we have achieved so far:

Benchmarks, clean baseline modules-pr613 vs new worktree modules-avail-opt:
  - full module avail --terse >/dev/null 2>&1
      - before: 5.991 s ± 0.157 s
      - after: 105.9 ms ± 1.4 ms
  - module avail --terse vendor1 >/dev/null 2>&1
      - before: 3.750 s ± 0.086 s
      - after: 203.7 ms ± 0.8 ms
  - module avail --terse vendor1/product1 >/dev/null 2>&1
      - before: 3.367 s ± 0.086 s
      - after: 142.7 ms ± 3.1 ms

  Sanity checks:
  - module avail --redirect --terse vendor1 | wc -l -> 50001
  - module avail --redirect --terse vendor1/product1 | wc -l -> 10001
  - module avail --redirect --terse vendor1/product1/0000* | wc -l -> 10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions