s there a way we can measure the performance of a Data Source or collectors?
Yes, there’s lots you can do.
Aren’t both making a WMI call? Aren’t both going to bring all the Processes in one go?
For Win_Service_Select_Groovy, it does one call to fetch all the services where startmode == auto. However, the discovery filters only create instances for those services that match the includeRegEx and do not match the excludeRegEx properties. Then during collection, it does fetch all the services and filter to only output the data for the services of interest.
For discovery, there is no good alternative other than to grab the entire list. You could go through grabbing them one at a time, but that would take more time than asking for them all at once.
For collection, you could switch from batchscript to script, which would spawn a task for each instance. This would essentially run the tasks in parallel, potentially improving performance. However, that method is more complicated than just grabbing everything and filtering in script. You could do it, but I didn’t. As to whether it would improve performance, you’d have to build it then test it out.