sakkoulas Posted May 24, 2013 Posted May 24, 2013 Hello everybody i don't know if this is a dumb idea, but is it possible (or it is not necessary) to test the response speed of selectors. for example $pages->get('/page/')->children('date>=$date'); $pages->find('template=name, date>=$date'); $pages->get('/page/')->find('date>=$date') which of those three selectors is faster, sorry again if this is dumb question. thanks
ryan Posted May 25, 2013 Posted May 25, 2013 Assuming those 3 result in identical results, most likely the 2nd one would be fastest since it is 1 API call rather than 2. The 1st one would be the second fastest since $page->children() is faster than $page->find, as it doesn't have to consider hierarchy beyond 1 level. These are my best guesses anyway. If you want to test them out, take a look at Debug::timer() (/wire/core/Debug.php). Also note you'll want to use double quotes for your selectors as the $date variable would not be dereferenced in single quotes. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now