Skip to content

[Docs/Perf] Per-element getBimElement() doesn’t scale — document bulk reads #94

Description

@SamuelAB-VIM

Environment

  • vim-web 1.0.0-alpha.0, IIFE build (dist/vim-web.iife.js) loaded via <script>
  • API: VIM.Core.Webgl.createViewer() (headless, custom UI)
  • Chromium / desktop, devicePixelRatio 1.75
  • Model: 2,547 elements (2,264 with geometry), 12 Revit categories, structural

Summary. The documented per-element path (element.getBimElement()) is fine for a handful
of elements but pathological for whole-model work. Reading the BIM tables in bulk is ~3 orders
of magnitude faster.

Measured (2,264-element model, same machine):

// Per element — the "obvious" path
await Promise.all(els.slice(0,100).map(e => e.getBimElement())); // >30s, timed out ❌

// Bulk — via the VimDocument tables
await Promise.all([
  vim.bim.element.getAllName(),
  vim.bim.element.getAllCategoryIndex(),
  vim.bim.element.getAllFamilyName(),
  vim.bim.element.getAllId(),
  vim.bim.category.getAllName(),
]);                                                              // ~13ms for the whole model ✅
// map with el.element (BIM index): names[el.element], catNames[catIdx[el.element]], …

Asks.

  • Document the bulk vim.bim.<table>.getAll*() pattern as the recommended approach for
    iterating many elements, and call out that getBimElement()/getBimParameters() are
    per-element conveniences not meant for full-model loops.
  • Consider a batched vim.getBimElements(indices?) that resolves an array in one pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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