Feat(Revit) : send performance enhancement#2825
Conversation
teocomi
left a comment
There was a problem hiding this comment.
Looks good, great finds!
Does caching the units conversion ratio really speed things up? Have you benchmarked it on a large model?
There was a problem hiding this comment.
If this is borrowed from the RevitAsync library, we should credit them :)
There was a problem hiding this comment.
Yes, much of it was borrowed. Does this just mean adding a comment in the class?
Yes it does. All of my optimizations were the result of profiling a large send operation. Caching the scale factor makes a big difference because we are calling scaleToSpeckle multiple times for every object converted. In my case I was sending ~5000 objects which lets say results in calling scaleToSpeckle 10,000 times. If caching the scale factor and using that saves 1ms over using Revit's "ConvertFromInternalUnits" method like we were doing, then the compound time savings would be 10s |
|
Cool, then merge away after adding the needed credits on the class :) |
|
Already merged into dev - the conversion logic here assumes that all conversions are by a multiplication factor between 1 and desired units. The internal Revit util ConvertFromInternalUnits for temperature for instance from internal (Kelvin) to target (e.g. Celcius) -272.15 therefore the returned value we are caching is not able to be reapplied by factor * value which for 30*C is returning -82000, say. |
Description & motivation
Changes:
replaced RevitAsync nuget package with custom APIContext class
Throttle Send operation
Optimizations for "ParameterToSpeckle"
Units to Speckle
Screenshots:
A previous PR lowered the conversion time for this tower from 100s to 70s. This PR lowers the conversion time even further to ~25 seconds.
Validation of changes:
All unit tests still pass
Checklist:
References