The part taking the most time is when you query the machine for the installed software. So I think u mean its not the code that is slow but the querying process and retrieving the data..
I tried to query a machine with 30+ programs so maybe thats why it took sometime.
Thanks jmcilhinney.