[evolvis-commits] r18438: I’ve been told PHP’s not-lambdas are exceptionally slow (and why)

mirabilos at evolvis.org mirabilos at evolvis.org
Wed May 30 17:55:32 CEST 2012


Author: mirabilos
Date: 2012-05-30 17:55:32 +0200 (Wed, 30 May 2012)
New Revision: 18438

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/www/tracker/admin/form-clonetracker.php
Log:
I’ve been told PHP’s not-lambdas are exceptionally slow (and why)

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/tracker/admin/form-clonetracker.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/tracker/admin/form-clonetracker.php	2012-05-30 15:55:28 UTC (rev 18437)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/tracker/admin/form-clonetracker.php	2012-05-30 15:55:32 UTC (rev 18438)
@@ -29,6 +29,13 @@
 $names = array();
 $has_error = false;
 
+function atsortbyname($a, $b) {
+	$av = $a->getName();
+	$bv = $b->getName();
+
+	return strcoll($av, $bv);
+}
+
 foreach ($tlist as $tp) {
 	if (!$tp || !is_object($tp) || $tp->isError()) {
 		/* skip it */
@@ -49,12 +56,7 @@
 		}
 		$ata[$at->getID()] = $at;
 	}
-	uasort($ata, create_function('$a, $b', '
-		$av = $a->getName();
-		$bv = $b->getName();
-
-		return strcoll($av, $bv);
-	    '));
+	uasort($ata, 'atsortbyname');
 	foreach ($ata as $aid => $at) {
 		$ids[] = $aid;
 		$names[] = sprintf('%s::%s (%d::%d)',



More information about the evolvis-commits mailing list