My test involved looping through all service objects that have host_name and service_description and filtering with the above methods. The test suite ran on a setup with 3028 different service objects and gave me the following findings:
# python Modelperf.py
Testing object filtering
3028 365.00 seconds
Testing grep objects.all from within loop filtering
3028 185.46 seconds
Testing grep with objects.all outside loop filtering
3028 36.11 seconds
As you can see the last method was factor 10 faster than running Model.Service.objects.filter()
You can download the source of Modelperf.py at https://gist.github.com/tomas-edwardsson/6230958
---
Tommi
--
You received this message because you are subscribed to the Google Groups "pynag-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynag-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.