A common complaint.
Not likely an issue but
"AmbientOcclusionProLoader.rb" has a comment at the top, viz:
The “loader” file is actually
"AmbientOcclusionProLoader.rb" file is strange in that it’s very busy with many large literal path strings and
if clauses that looked to have been switched off by adding
Here for what it’s worth is a more dynamic loader file, as an example, etc.
AmbientOcclusionProLoader_dynamic.rb (1.4 KB)
I don’t think your extension registrar file needs that
DummyLanguageHandler anymore if you are not supporting SketchUp versions under 14 (and it looks like only v17+.)
"AmbientOcclusionPro.rb" file has an issue. It repeatedly (from quite a few
UI::Command procs,) calls an
#init method, which will call
Kernel#require with a large string argument. This is done apparently to be sure the compiled code is loaded.
But each time this is called, the very large global
$LOADED_FEATURES array must be iterated and each member path string checked for a match to this argument path string. Ruby String comparison is quite slow, so this method of checking if your resource is loaded is inefficient.
You could set a boolean
@core_loaded variable to
true after the binaries are loaded, and thereafter check this before calling
… or, even better, if your binaries define any methods, you could simply ask the module if it
For example, I see that there is reference to a
"initAPI" method that is not defined in Ruby.
This (or a similar method defined in C) could be used as a loaded test. Ie …
return if self.respond_to?(:initAPI)
In this way you can avoid the needless path string checking once the binaries are loaded.