Relevance Optimization for App Install

Hello,

Is it better to have several relevance statements in one line, connected with several AND/OR statements, or should each statement be its own expression? I’m trying to write a fixlet which installs an application but has four relevance statements. I have them separate, each as its own expression and I am getting machines which should not be relevant. For example, I am getting Macs relevant to the following statement (Relevance 1).

(windows of operating system) AND ((version of operating system) >= “10.0.18363”) #Windows 10 version 1909 or later.

That statement alone should not include any Macs. Is it being OR’d with any other statements that might be causing the false-positive?

Generally, separating the Relevance statements is just done for human-readability. When the client evaluates, each statement is AND’d together.

When there are multiple statements (or clauses), it’s generally best to start with either the fastest-evaluating, or the statement that excludes the most systems. The first clause of a Relevance statement that returns False will short-circuit the evaluation (the client doesn’t spend any time evaluating the remaining clauses after the first False).

2 Likes

I don’t have any proof of it and no real way to test/measure it, but wouldn’t it be faster of each inspector is “initialized” once? I would imagine that there is some kind of relevance inspector “initialization time”, where the specific inspector is loaded up from a DLL or whatever the library is, even if that time is extremely quick, so if you “reuse” that inspector might be faster than “initializing” it twice within the same statement? Consider the following two examples:

(windows of operating system) AND ((version of operating system) >= "10.0.18363")

(windows of it AND version of it >= "10.0.18363") of operating system

The first essentially, tries to initiated the “operating system” inspector twice independently of one another and then use specific sub-inspectors of it; the latter loads it once within the same call and access the same two inspectors. Might be completely off here or even if I am not, maybe those inspector initialization times to be completely negligible for this particular inspector but I would imagine if you get to using wmi inspector or something heavier like that it would make a difference… Just my thoughts.

2 Likes

Great idea. Thanks! …

Awesome suggestion. Especially, the processing order for relevance. Thanks

Yes, this is an excellent point. It won’t make much difference with these specific properties (most of the ‘operating system’ inspectors are cached on the client or are very fast API calls), but the approach can definitely make a big difference with WMI calls or File property calls.

1 Like