Skip to content

Revit 2015 to 2023 exports read every wall record twice for its top join, and GStyleElem twice for category materials #1824

Open

Description

@DrunkOnJava

What

On the 2015 to 2023 path of partition_schema_mvp, two native passes read records another pass of the same export has already read. Read on main at 97397b9.

  1. Every wall record is read twice; the second read exists only for the top join.
    • native_walls_and_top_joins_into (src/research/native_walls.rs:808, called from attach_wall_layers) reads each wall's SWall/ArcWall record whole. It keeps type ids, Functions and bearing in WallReads (:1076-1081), but not the top join it also reads.
    • So read_wall_records (partition_schema_mvp/walls.rs:993) calls WallReads::read again over every wall (native_walls.rs:680, selection type_walls ∪ join_walls), only to get m_wall_top_joined.
    • Each wall then carries m_wall_top_joined twice: from walls.rs:1184 (the first read) and walls.rs:1084 (the second). The one consumer, export_content.rs:3025-3032, takes the first.
    • Keeping top_joined and top_joins_read in WallReads there, and passing every wall id, would make the second read's selection empty. That saves one extract_graphs call and the projected decode of every wall, with the same value on the same record.
  2. Every GStyleElem is read twice on a file with walls and curtain parts.
    • partition_curtain_materials::category_material (:122) and partition_materials::category_style_materials (:613) both select every GStyleElem. Only the second is memoised on the handle.
    • Their rules differ: the first filters to known materials and needs every style equal, the second needs exactly one distinct value. So a fold keeps both rules over one read.

A question to settle first

category_style_materials sets no releases, so it runs on Options::default()'s 2023 to 2027. On 2015 to 2022, extract_records refuses it ("this native reader is not measured on Revit {version}"), and scan_category_material swallows the refusal (partition_materials.rs:585). The RE-91 graphics-style fallback for wall layers therefore reads nothing on 2015 to 2022, while the curtain reader sets NATIVE_RELEASES.

That may be deliberate, a measurement boundary, or an omission. Folding (2) would extend the curtain reader's range to the wall-layer path, so it has to be decided first. Deciding needs a 2015 to 2022 file whose Walls object-styles entry is unset and whose Walls GStyleElem names a material, together with Revit's export of it.

Done when

  • (1) is folded. An unfiltered Measure shows every export byte for byte as before, and a timing run shows the 2015 to 2023 samples no slower.
  • (2) is folded, or left with the reason; the release question above is answered with the file that settles it.

Found by a Tendrils audit worker; the code references were checked by rvtDevelop.

Activity

  1. DrunkOnJava commented on Nov 12, 2026

    @DrunkOnJava
    OwnerAuthor

    A note from #1828's review, outside its scope.

    native_walls_and_top_joins_into marks every wall it was asked for as having its load bearing read (reads.bearing_read.extend(walls)), including a wall whose whole graph did not decode. Such a wall never gets the second chance in WallReads::load_bearing's projected read, which builds far less. The same applied to the top joins until #1828 marked only the walls it found one for.

    On the models measured so far it moves nothing: a wall whose whole graph fails to decode has not been seen in a Measure run. It would matter only for a wall whose record busts max_graph_values in full but not projected. The fix would be the same as #1828's, bearing_read.extend(bearing.keys()), and it is left for when such a wall turns up.

  2. DrunkOnJava commented on Nov 14, 2026

    @DrunkOnJava
    OwnerAuthor

    Where this stands on main (2b4f18b):

    1. Wall records read twice: done by perf(research): the wall read that draws a Revit 2015 to 2023 export's walls keeps their top joins, so the export does not read every wall's record again for them (#1824) #1828 (925c482). native_walls_and_top_joins_into keeps each wall's top join in WallReads (top_joined, top_joins_read, src/research/native_walls.rs:1164-1175), so read_wall_records' second WallReads::read has nothing left to select.

    2. GStyleElem read twice: narrower than this issue says. The two readers run on different releases:

      • partition_curtain_materials::category_material runs only where CURTAIN_32BIT_REVIT_VERSIONS holds (2015 to 2023, partition_schema_mvp/materials.rs:337);
      • partition_materials::native_category_material runs on Options::default()'s 2023 to 2027, and only where the object-styles entry gives no material.

      So the second read happens only on a Revit 2023 file that has both curtain parts and walls with no object-styles material. A fold saves at most one GStyleElem pass on such a file. It also needs care: the two readers decode ids differently (native_metadata::identifier against /m_id/m_id64 only), so one shared read has to keep both decodings to leave the exports as they are.

    The release question above (whether the wall-layer fallback should read 2015 to 2022) is unchanged. It still needs a 2015 to 2022 file whose Walls object-styles entry is unset and whose Walls GStyleElem names a material, with Revit's export of it. That question, not the saving, is what keeps this open.

  3. added
    type:bug
    area:reader
    priority:P3
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:readerpriority:P3type:bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions