Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added array push benchmark for php

  • Loading branch information...
commit 4312cd24ef10b716c0f20a52f55a2863cd982c71 1 parent f007edf
@felixge authored
Showing with 19 additions and 0 deletions.
  1. +3 −0  Makefile
  2. +16 −0 benchmark/php/array-push.php
View
3  Makefile
@@ -7,6 +7,9 @@ benchmark-v8:
benchmark-php:
@find benchmark/php/*.php | xargs -n 1 -t php
+benchmark-all: benchmark-v8 benchmark-php
+ @find benchmark/*.js | xargs -n 1 -t node
+
benchmark:
@find benchmark/*.js | xargs -n 1 -t node
View
16 benchmark/php/array-push.php
@@ -0,0 +1,16 @@
+<?php
+ini_set('memory_limit', '256M');
+
+$COUNT = 1e6;
+$a = array();
+
+$start = microtime(true);
+for ($i = 0; $i < $COUNT; $i++) {
+ array_push($a, $i);
+}
+
+$ms = (microtime(true) - $start) * 1000;
+$mhz = ((($COUNT / ($ms / 1000)) / 1e6));
+$million = $COUNT / 1e6;
+
+echo sprintf("%.2f Mhz (%d million in %d ms)\n", $mhz, $million, $ms);
Please sign in to comment.
Something went wrong with that request. Please try again.