mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-30 16:43:00 +00:00
ifcviewer: don't block the UI while baking the .ifcview at 100%
Opening a fresh .ifc streams geometry to the GPU, then bakes the .ifcview cache. That bake — reorder + per-chunk zstd (level 19) — ran synchronously in SceneLoader::onStreamerFinished, which is a QueuedConnection slot on the main thread, so it froze the UI right as the progress bar hit 100% (≈15s of zstd for a 130 MB-geometry model). - Move the compress + writeSidecar onto a background thread. The geometry is already resident and the sidecar is only a cache for the next open, so the viewport is interactive the instant streaming finishes; the write is joined before the next write and in the destructor. - Parallelise the per-chunk zstd across hardware_concurrency threads (compress all chunks, then write serially to keep contiguous offsets) so the background write also finishes quickly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -173,6 +173,10 @@ private:
|
||||
uint32_t next_session_model_id_ = 1;
|
||||
uint32_t loading_session_model_id_ = 0;
|
||||
std::thread sidecar_read_thread_;
|
||||
// Background .ifcview compress + write, so the seconds of zstd on a big
|
||||
// model don't freeze the UI at 100%. Joined before the next write and in
|
||||
// the destructor so a pending write always completes.
|
||||
std::thread sidecar_write_thread_;
|
||||
// One thread per sidecar-hit model while its .rdb/.ifc opens in the
|
||||
// background. Joined only at destruction so a slow SPF parse on model
|
||||
// A never blocks the sidecar-hit path of model B.
|
||||
|
||||
Reference in New Issue
Block a user