Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $start_time = microtime(true);
- foreach (range(1, 1000) as $id) {
- $node = Drupal::entityTypeManager()->getStorage('node')->load($id);
- if ($node) {
- print_r($node->id());
- }
- }
- $end_time = microtime(true);
- $execution_time = ($end_time - $start_time);
- print_r($execution_time);
- $start_time = microtime(true);
- $ids = [];
- foreach (range(1, 1000) as $id) {
- $ids[] = $id;
- }
- $nodes = Drupal::entityTypeManager()->getStorage('node')->loadMultiple($ids);
- foreach ($nodes as $node) {
- if ($node) {
- print_r($node->id());
- }
- }
- $end_time = microtime(true);
- $execution_time = ($end_time - $start_time);
- print_r($execution_time);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement