I would like to run an optimization and it would be great if there was a way to cut all the “unnecessary” calculations within the analysis components to streamline only the data I need with only the outputs I need to lower computation costs.
I’m specifically looking at Ladybug and Honeybee components for environmental simulations.
Anyone know how?
You can delete any calls to these functions. If they’re not functions (i.e. chunks of code within some larger scope) you can comment them out instead. If the performance issue is that outputting the data is the expensive part (it might be), you can remove the output entirely (i.e. using the ZUI), wrap the data in something less expensive, or simply set the data of the output variable to
None at the end of the script.
First step though is profiling the code to identify the actual bottlenecks. You can use something like this stopwatch to do this:
""" A simple profiler """
# Start the timer
self.startTime = time.time()
# Print an return elapsed time
elapsedSeconds = time.time() - self.startTime
elapsedMilliseconds = elapsedSeconds*1000
print str(round(elapsedMilliseconds,3)) + " ms"