Created
January 29, 2015 00:21
-
-
Save mkorostoff/6026a3b51f360084bb5a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Example 1: fetch all node IDs using db_select | |
$startTime = microtime(true); | |
$result = db_select('node', 'n') | |
->fields('n') | |
->execute() | |
->fetchAll(); | |
echo "Elapsed time is: ". (microtime(true) - $startTime) ." seconds"; | |
//prints 0.25 seconds | |
//Example 2: fetch all nodes using EntityFieldQuery | |
$startTime2 = microtime(true); | |
$query = new EntityFieldQuery(); | |
$query->entityCondition('entity_type', 'node')->execute(); | |
echo "Elapsed time is: ". (microtime(true) - $startTime2) ." seconds"; | |
//prints 0.1 seconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment