Files
2ez4gcxandClaude Opus 5.5 d290fc886f fix(doc, io): look linetypes, styles and layouts up by name through an index
Drawing::linetype, text_style, dim_style and layout scanned their table,
once per entity while a drawing is drawn, measured or saved, and once
per layout after every command. The DXF reader also scanned the
dimension styles once per DIMSTYLE record and the layouts by exact name
once per paper-space object. So a crafted file of N records and N
entities naming one it lacks, N DIMSTYLE records, or N layouts with N
objects in the last of them cost N^2 name comparisons (#1924, F-04
item 3): at N = 40 000 a PNG export took 23 s, opening 107-151 s or
more than 300 s on main.

- linetypes, text_styles, dim_styles and layouts are NamedLists (from
  #3484) and the four lookups use its index: the first entry of a name
  in list order, ASCII case folded, as the scan returned.
- NamedList::by_name_mut: the first entry of a name to change.
- Scans with the same answer go through the lookup (STYLE, DIMSTYLE,
  RENAME, -DIMSTYLE, .lin loading, COMPARE, COUNT, UCS, plotter, DXF
  header, Layers panel).
- The DXF reader indexes DIMSTYLE records by lower-cased name, and maps
  layout names (exact) to the first layout of that name once per pass.

Cost tests (doc: one per table; io: DIMSTYLE records and layouts) fail
on main at 66-421 s and pass within 3 s; a behaviour test compares
every lookup with a scan.

Part of #1924

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 14:02:33 +07:00
..