iTwin / imodel-transformer

API for exporting an iModel's parts and also importing them into another iModel
MIT License
3 stars 2 forks source link

single query bulk getElement #7

Open MichaelBelousov opened 1 year ago

MichaelBelousov commented 1 year ago

The exporter (for better or for worse) will always run IModelDb.elements.getElement on all elements. The new polymorphic ECSQL query syntax SELECT $ FROM bis.Element allows us to use one query to get all the json that otherwise the iTwin.js native layer would produce. With some slight json post processing of the results of that query, we can call IModelDb.constructEntity with the props and the known class from the class registry, and get an element just as we would have if we called getElement directly, but through one query for all elements.

The attached branch has most of this done already, but performance analysis needs to be done on it, the current work isn't discernibly faster than the existing work, which indicates it may not be a bottleneck.

How to do faster INSERT/UPDATE (which should be more of a bottleneck) is another question that may require discussion with the ECDb maintainers.

MichaelBelousov commented 1 year ago

need to rerun tests, just fixed not preparing the statement

MichaelBelousov commented 11 months ago

I created a no-platform polymorphic insert test as well on the early-polymorphic-insert test branch