Closed shorowit closed 4 years ago
I ran tests locally on Windows Subsystem for Linux (WSL) with the existing CLI using:
openstudio -I OpenStudio-workflow-gem/lib/ -e "t = Time.now; load 'openstudio-workflow.rb'; puts \"#{Time.now - t}\""
Original: 1.1 sec Modified: 0.6 sec
Windows should show even larger improvements.
Would love to get this into OS v3.
As long as tests pass I'm ok with it. I wonder why it's so slow and whether a lightweight replacement exists, but that's just curiosity.
Good find anyways!
Actually I think we are (trying?) Embedding nokogiri native which could be a replacement candidate, and faster at parsing at least
Yep, nokogiri would help address this.
Similarly, loading the json_pure gem is also a performance hotspot. Embedding the C json gem would address that. JSON parsing occurs throughout the gem so there's no easy way to lazy load like I could do here.
The json_pure gem is being removed in OpenStudio 3. So that should help too.
Currently
require 'rexml/document'
is called during invocation; it takes ~0.75 seconds on Windows and ~0.5 seconds on Linux. But REXML is only used in one very specific situation when there are report files. Therefore, we can move the require statement into the report code block and lazy load REXML.