Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 0.5.8
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
When I run Ohai and return all attributes, it takes about 2 seconds:
$ time ohai > /dev/null real 0m2.061s user 0m1.540s sys 0m0.710s
It ought to take much less time to calculate the json for only a single attribute, but it doesn't:
$ time ohai filesystem > /dev/null real 0m2.016s user 0m1.580s sys 0m0.620s
It appears as if Ohai is executing all code and then filtering it down to only display the requested attribute. If this is the case, shouldn't it be possible to avoid executing code for unwanted attributes, thus speeding up Ohai in this case?
It's impossible for ohai to save time because it doesn't know beforehand which plugins will be populating which attributes. Therefore it HAS to go through them all before selecting your attribute.
A valid workaround is to include only the plugins you'll need in your ohai configuration file, this can be done via the -f flag.