Skip to content

d2-rs 0.1.3

Choose a tag to compare

@nelsonjchen nelsonjchen released this 09 Nov 17:02

Matches Go D2 master at 6a7b48378, as 0.1.0 does.

Fixed

  • Isometric SVG export was up to 50x slower than Go on grid-heavy boards
    (Fulcro RAD 6.6 s against Go's 0.4 s). Numbers are formatted in one pass
    and grid cells share the document's assets instead of copying them, as
    in Go; every isometric board in the benchmark now runs faster than Go.
  • TALA: the 400-node fan-out error path, long labels and fan-out memory are
    now at or near Go (1.07x, 1.00x and 1.005x), and the 80,000-edge board
    uses 10% less memory. Placement trees no longer search the whole tree
    per node, and the TALA call site borrows the graph instead of copying
    every edge.
  • About 40 layout and rendering differences found by fuzzing every engine
    and output format against Go, including:
    • Markdown: empty headings missing from PDF, raw inline HTML, HTML tag
      names, form feeds in labels and a parser hang.
    • Text: zero-width joiners and mixed-script labels in PNG, PDF and PPTX;
      small Unicode and emoji runs in PNG.
    • Sketch mode in PNG: ellipses, shadows and multiline class labels.
    • TALA: nested and wrapper containers, ancestor edges, cloud and circle
      containers, grids, classes and routing.
    • ELK: self-loops inside containers and on SQL table columns, zero-height
      grids, nested sequence diagrams and cloud shapes.
    • Dagre: edges leaving a container toward the same node, and several PNG
      and SVG layouts.
    • Class cycles report the first back-edge only; the CLI prints Go's
      info: line before compile errors.
  • Layouts found by checking every small graph against Go:
    • Dagre: children of a container that are each fed from outside no
      longer overlap (p -> k.a with q -> k.b); parallel labeled edges
      with a self-loop inside a container keep their labels next to the
      nodes. Over 500,000 enumerated small graphs match Go.
    • ELK: edges crossing nested containers, parallel labeled edges with a
      self-loop, content bounds, compound and root loops and negative
      coordinates. All 2,750,800 canonical five-node graphs with three or
      four edges match Go.
    • TALA: dense graphs (an 80-node network, 40 nodes in six containers),
      hierarchy eligibility, clustered containers and nested routes. The
      80-node network with --tala-seeds 3 now takes 7.1 s against Go's
      9.2 s (16.3 s before).
  • Negative width and height are rejected as in Go; a capitalised
    reserved key such as Shape: gives Go's errors.
  • Custom fonts: --sketch measures labels with the user's font, each
    role keeps its own face in PNG, and Markdown uses custom faces as in Go.
  • PNG: gradient edge strokes and gradient font colors in sketch mode and
    dark themes match Go.
  • Output files get Go's permission bits for every format.
  • npm package: one copy of the WebAssembly payload instead of two (30 MB
    smaller), loaded once in Node; correct types for Node CommonJS and ESM
    and for @d2-rs/wasm/raw. It no longer ships stale files from earlier
    builds.
  • Published crates no longer include internal test fixtures; README links
    work on crates.io and npm, and the README names the crates to use as a
    Rust library.

Known issues

  • TALA: per-seed routing memory is still slightly above Go's, a 400-node
    fan-out reaches its error at about 1.07x Go's wall time, and an
    80,000-edge board peaks at about 1.33x Go's memory.
  • The native CLI binary is about 1.2x the size of Go's.

Install: cargo install d2-rs --version 0.1.3 or npm install @d2-rs/wasm@0.1.3.