silverstripe/silverstripe-cms — pull request #252 by mateusz (2012-12-04 02:07:32+00:00)
Title: BUG Remove handwritten SQL and use the ORM.

The custom SQL does not take subsites into account and breaks the CMS
on certain pages - under some circumstances the custom count will return
1 or more, while the set will be in fact empty because of augmentation.

With three dependent-pages and 3 minute benchmark, it looks like there is no performance hit:

BEFORE:
50% 612
66% 622
75% 686
80% 688
90% 694
95% 699
98% 768
99% 1054
100% 1710 (longest request)

AFTER
50% 605
66% 616
75% 675
80% 680
90% 685
95% 693
98% 762
99% 1027
100% 1040 (longest request)