Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transforming DisplayStyles with huge amounts of element references has a big impact on memory and performance #203

Closed
ViliusRuskys opened this issue Aug 30, 2024 · 2 comments · Fixed by #206
Assignees

Comments

@ViliusRuskys
Copy link
Contributor

The test iModel I tested it on had 210 DisplayStyle3D Elements. Each of those had more than 250k element references in jsonProps.excludedElements.
Cloning each DisplayStyle takes close to 1minute of processing time (later on it takes more than that because of a different issue).

Because transformer processes definition elements first, all those references are not found in the target iModel at the moment the DisplayStyle is processed, so remapping them is impossible and the DisplayStyle is inserted as a "partial element". Currently transformer is very inefficient in storing the partially committed entity references and in this specific scenario it amounts to a large performance hit and requires a lot of memory.

@ViliusRuskys ViliusRuskys self-assigned this Aug 30, 2024
@MichaelBelousov
Copy link
Contributor

MichaelBelousov commented Aug 30, 2024

Saw this by email...

Another possible approach which the experimental branch I made a long time ago did, was insert an "empty" element for each element that was missing references (which the current branch does now) but update at the end instead of when the reference becomes valid.

Then you change the $\approx O(n^2)$ memory space complexity with $O(n)$ since you only need to store which elements to update, not when to update them (stored as the references it's waiting for).

This is probably both faster and simpler for multiple reasons.

@MichaelBelousov
Copy link
Contributor

I actually recorded this proposal already in the last bullet point here:
#83 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants