[Linpha-cvs] SF.net SVN: linpha: [4917] trunk/misc/benchmark
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2008-04-06 21:40:40
|
Revision: 4917 http://linpha.svn.sourceforge.net/linpha/?rev=4917&view=rev Author: fangehrn Date: 2008-04-06 14:40:37 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Added Paths: ----------- trunk/misc/benchmark/AdoDBperfMon.php trunk/misc/benchmark/arrayIndex.php trunk/misc/benchmark/array_change_key_case.php trunk/misc/benchmark/stringConcatvsArrayJoin.php Removed Paths: ------------- trunk/misc/benchmark/perf.php Copied: trunk/misc/benchmark/AdoDBperfMon.php (from rev 4881, trunk/misc/benchmark/perf.php) =================================================================== --- trunk/misc/benchmark/AdoDBperfMon.php (rev 0) +++ trunk/misc/benchmark/AdoDBperfMon.php 2008-04-06 21:40:37 UTC (rev 4917) @@ -0,0 +1,25 @@ +<?php +define('LINPHA_DIR','../../linpha2'); + +if (!file_exists(LINPHA_DIR.'/logsql.txt')) +{ + die("To enable sql logging create the file linpha/logsql.txt"); +} + +include_once(LINPHA_DIR.'/lib/include/common.php'); + +/** + * some init stuff + */ + require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); + global $linpha; + $linpha = new Linpha(); + $linpha->sql->startSession(); + +/** + * do perf + */ + $perf = &NewPerfMonitor($GLOBALS['linpha']->db); + define('ADODB_PERF_NO_RUN_SQL',1); + $perf->UI($pollsecs=5); +?> \ No newline at end of file Added: trunk/misc/benchmark/arrayIndex.php =================================================================== --- trunk/misc/benchmark/arrayIndex.php (rev 0) +++ trunk/misc/benchmark/arrayIndex.php 2008-04-06 21:40:37 UTC (rev 4917) @@ -0,0 +1,407 @@ +<?php +class TestTags +{ + public static $metaTags = array( + 'xmp' => array( + + //Iptc4xmpCore schema tags + 'countrycode', + 'intellectualgenre', + 'location', + 'scene', + 'subjectcode', + + //Dublin Core schema tags + 'contributor', + 'coverage', + 'creator', + 'date', + 'description', + 'format', + 'identifier', + 'publisher', + 'rights', + 'subject', + 'title', + + //Adobe Photoshop schema tags + 'authorsposition', + 'captionwriter', + 'category', + 'city', + 'colormode', + 'country', + 'credit', + //'datecreated', + 'headline', + 'iccprofilename', + 'instructions', + 'source', + 'state', + 'supplementalcategories', + 'transmissionreference', + 'urgency' + ), + + //IPTC schema tags + 'iptc' => array( + + //IPTC ApplicationRecord Tags + 'applicationrecordversion', + 'objecttypereference', + 'objectattributereference', + 'objectname', + 'objectcycle', + 'editstatus', + 'subjectreference', + //'category', + 'supplementalcategories', + 'keywords', + 'specialinstructions', + 'datecreated', + 'timecreated', + 'by_line', + 'by_linetitle', + //'city', + 'sub_location', + 'province_state', + 'country_primarylocationcode', + 'country_primarylocationname', + 'originaltransmissionreference', + //'headline', + //'credit', + //'source', + 'copyrightnotice', + 'contact', + 'caption_abstract', + 'writer_editor', + 'originatingprogram', + 'releasedate' + ), + + //EXIF schema tags + 'exif' => array( + + //IFD0 + 'processingsoftware', + 'imagewidth', + 'imagelength', + 'bitspersample', + 'compression', + 'photometricinterpretation', + 'thresholding', + 'cellwidth', + 'celllength', + 'fillorder', + 'documentname', + 'imagedescription', + 'make', + 'model', + 'orientation', + 'samplesperpixel', + 'rowsperstrip', + 'minsamplevalue', + 'maxsamplevalue', + 'xresolution', + 'yresolution', + 'planarconfiguration', + 'pagename', + 'xposition', + 'yposition', + 'grayresponseunit', + 'resolutionunit', + 'pagenumber', + 'software', + 'modifydate', + 'artist', + 'hostcomputer', + 'predictor', + 'whitepoint', + 'primarychromaticities', + 'halftonehints', + 'tilewidth', + 'tilelength', + 'ycbcrcoefficients', + 'ycbcrsubsampling', + 'ycbcrpositioning', + 'referenceblackwhite', + 'relatedimagefileformat', + 'relatedimagewidth', + 'relatedimagelength', + 'rating', + 'ratingpercent', + 'copyright', + + //ExifIFD + 'exposuretime', + 'fnumber', + 'exposureprogram', + 'spectralsensitivity', + 'iso', + 'timezoneoffset', + 'selftimermode', + 'exifversion', + 'datetimeoriginal', + 'createdate', + 'componentsconfiguration', + 'compressedbitsperpixel', + 'shutterspeedvalue', + 'aperturevalue', + 'brightnessvalue', + 'exposurecompensation', + 'maxaperturevalue', + 'subjectdistance', + 'meteringmode', + 'lightsource', + 'flash', + 'focallength', + 'imagenumber', + 'securityclassification', + 'imagehistory', + 'subjectlocation', + 'exposureindex', + 'sensingmethod', + 'filesource', + 'scenetype', + 'cfapattern', + 'customrendered', + 'exposuremode', + 'whitebalance', + 'digitalzoomratio', + 'focallengthin35mmformat', + 'scenecapturetype', + 'gaincontrol', + 'contrast', + 'saturation', + 'sharpness', + 'subjectdistancerange', + 'gamma' + ) + ); + + public static $metaTags2 = array( + 'xmp' => array( + + //Iptc4xmpCore schema tags + 'countrycode' => 'asdf', + 'intellectualgenre' => 'asdf', + 'location' => 'asdf', + 'scene' => 'asdf', + 'subjectcode' => 'asdf', + + //Dublin Core schema tags + 'contributor' => 'asdf', + 'coverage' => 'asdf', + 'creator' => 'asdf', + 'date' => 'asdf', + 'description' => 'asdf', + 'format' => 'asdf', + 'identifier' => 'asdf', + 'publisher' => 'asdf', + 'rights' => 'asdf', + 'subject' => 'asdf', + 'title' => 'asdf', + + //Adobe Photoshop schema tags + 'authorsposition' => 'asdf', + 'captionwriter' => 'asdf', + 'category' => 'asdf', + 'city' => 'asdf', + 'colormode' => 'asdf', + 'country' => 'asdf', + 'credit' => 'asdf', + //'datecreated' => 'asdf', + 'headline' => 'asdf', + 'iccprofilename' => 'asdf', + 'instructions' => 'asdf', + 'source' => 'asdf', + 'state' => 'asdf', + 'supplementalcategories' => 'asdf', + 'transmissionreference' => 'asdf', + 'urgency' + ), + + //IPTC schema tags + 'iptc' => array( + + //IPTC ApplicationRecord Tags + 'applicationrecordversion' => 'asdf', + 'objecttypereference' => 'asdf', + 'objectattributereference' => 'asdf', + 'objectname' => 'asdf', + 'objectcycle' => 'asdf', + 'editstatus' => 'asdf', + 'subjectreference' => 'asdf', + //'category' => 'asdf', + 'supplementalcategories' => 'asdf', + 'keywords' => 'asdf', + 'specialinstructions' => 'asdf', + 'datecreated' => 'asdf', + 'timecreated' => 'asdf', + 'by_line' => 'asdf', + 'by_linetitle' => 'asdf', + //'city' => 'asdf', + 'sub_location' => 'asdf', + 'province_state' => 'asdf', + 'country_primarylocationcode' => 'asdf', + 'country_primarylocationname' => 'asdf', + 'originaltransmissionreference' => 'asdf', + //'headline' => 'asdf', + //'credit' => 'asdf', + //'source' => 'asdf', + 'copyrightnotice' => 'asdf', + 'contact' => 'asdf', + 'caption_abstract' => 'asdf', + 'writer_editor' => 'asdf', + 'originatingprogram' => 'asdf', + 'releasedate' + ), + + //EXIF schema tags + 'exif' => array( + + //IFD0 + 'processingsoftware' => 'asdf', + 'imagewidth' => 'asdf', + 'imagelength' => 'asdf', + 'bitspersample' => 'asdf', + 'compression' => 'asdf', + 'photometricinterpretation' => 'asdf', + 'thresholding' => 'asdf', + 'cellwidth' => 'asdf', + 'celllength' => 'asdf', + 'fillorder' => 'asdf', + 'documentname' => 'asdf', + 'imagedescription' => 'asdf', + 'make' => 'asdf', + 'model' => 'asdf', + 'orientation' => 'asdf', + 'samplesperpixel' => 'asdf', + 'rowsperstrip' => 'asdf', + 'minsamplevalue' => 'asdf', + 'maxsamplevalue' => 'asdf', + 'xresolution' => 'asdf', + 'yresolution' => 'asdf', + 'planarconfiguration' => 'asdf', + 'pagename' => 'asdf', + 'xposition' => 'asdf', + 'yposition' => 'asdf', + 'grayresponseunit' => 'asdf', + 'resolutionunit' => 'asdf', + 'pagenumber' => 'asdf', + 'software' => 'asdf', + 'modifydate' => 'asdf', + 'artist' => 'asdf', + 'hostcomputer' => 'asdf', + 'predictor' => 'asdf', + 'whitepoint' => 'asdf', + 'primarychromaticities' => 'asdf', + 'halftonehints' => 'asdf', + 'tilewidth' => 'asdf', + 'tilelength' => 'asdf', + 'ycbcrcoefficients' => 'asdf', + 'ycbcrsubsampling' => 'asdf', + 'ycbcrpositioning' => 'asdf', + 'referenceblackwhite' => 'asdf', + 'relatedimagefileformat' => 'asdf', + 'relatedimagewidth' => 'asdf', + 'relatedimagelength' => 'asdf', + 'rating' => 'asdf', + 'ratingpercent' => 'asdf', + 'copyright' => 'asdf', + + //ExifIFD + 'exposuretime' => 'asdf', + 'fnumber' => 'asdf', + 'exposureprogram' => 'asdf', + 'spectralsensitivity' => 'asdf', + 'iso' => 'asdf', + 'timezoneoffset' => 'asdf', + 'selftimermode' => 'asdf', + 'exifversion' => 'asdf', + 'datetimeoriginal' => 'asdf', + 'createdate' => 'asdf', + 'componentsconfiguration' => 'asdf', + 'compressedbitsperpixel' => 'asdf', + 'shutterspeedvalue' => 'asdf', + 'aperturevalue' => 'asdf', + 'brightnessvalue' => 'asdf', + 'exposurecompensation' => 'asdf', + 'maxaperturevalue' => 'asdf', + 'subjectdistance' => 'asdf', + 'meteringmode' => 'asdf', + 'lightsource' => 'asdf', + 'flash' => 'asdf', + 'focallength' => 'asdf', + 'imagenumber' => 'asdf', + 'securityclassification' => 'asdf', + 'imagehistory' => 'asdf', + 'subjectlocation' => 'asdf', + 'exposureindex' => 'asdf', + 'sensingmethod' => 'asdf', + 'filesource' => 'asdf', + 'scenetype' => 'asdf', + 'cfapattern' => 'asdf', + 'customrendered' => 'asdf', + 'exposuremode' => 'asdf', + 'whitebalance' => 'asdf', + 'digitalzoomratio' => 'asdf', + 'focallengthin35mmformat' => 'asdf', + 'scenecapturetype' => 'asdf', + 'gaincontrol' => 'asdf', + 'contrast' => 'asdf', + 'saturation' => 'asdf', + 'sharpness' => 'asdf', + 'subjectdistancerange' => 'asdf', + 'gamma' => 'asdf' + ) + ); +} + + +$startTime = microtime(true); + +for($n2 = 0, $i = 0; $i < 10000; $i++) +{ + if (isset(TestTags::$metaTags['exif']['sharpness'])) + { + $n2++; + } +} + +$endTime = microtime(true); +echo ($endTime - $startTime).'<br />'; + + +$startTime = microtime(true); + +for($n1 = 0, $i = 0; $i < 10000; $i++) +{ + if (in_array('sharpness', TestTags::$metaTags['exif'])) + { + $n1++; + } +} + +$endTime = microtime(true); +echo ($endTime - $startTime).'<br />'; + + + + +/** +0.0324549674988 +0.242530107498 + +0.0326819419861 +0.156526088715 + +0.0325179100037 +0.155251026154 + +0.0322420597076 +0.151906013489 + */ + + +?> \ No newline at end of file Added: trunk/misc/benchmark/array_change_key_case.php =================================================================== --- trunk/misc/benchmark/array_change_key_case.php (rev 0) +++ trunk/misc/benchmark/array_change_key_case.php 2008-04-06 21:40:37 UTC (rev 4917) @@ -0,0 +1,137 @@ +<?php + +$array = array( + + //IFD0 + 'processingsoftware', + 'imagewidth', + 'imagelength', + 'bitspersample', + 'compression', + 'photometricinterpretation', + 'thresAholding', + 'cellwidth', + 'celllength', + 'fillorder', + 'documentname', + 'imagedescription', + 'make', + 'model', + 'orientation', + 'samplesperpixel', + 'rowsperstrip', + 'minsamplevalue', + 'maxsamplevalue', + 'xresoDlution', + 'yresolution', + 'planarconfiguration', + 'pagename', + 'xposition', + 'yposition', + 'grayresponseunit', + 'resolutionunit', + 'pagenumber', + 'software', + 'modifFydate', + 'artist', + 'hostcomputer', + 'preEdictor', + 'whitepoint', + 'primarychromaticities', + 'halfFtonehints', + 'tilewidth', + 'tilelength', + 'ycbcrcoefficients', + 'ycbcrsEubsampling', + 'ycbcrpositioning', + 'referenceblackwhite', + 'relateDdimagefileformat', + 'relatedimagewidth', + 'relateCdimagelength', + 'rating', + 'ratingpercent', + 'copyright', + + //ExifIFD + 'exposuretime', + 'fnumber', + 'exposureprogram', + 'spectralsensitivity', + 'iso', + 'timezoneoffset', + 'selftimermode', + 'exifversion', + 'datetimeoriginal', + 'createdate', + 'componentsconfiguration', + 'compressedbitsperpixel', + 'shutterspeedvalue', + 'aperturevalue', + 'brightnessvalue', + 'exposurecompensation', + 'maxaperturevalue', + 'subjectdistance', + 'meteringmode', + 'lightsource', + 'flash', + 'focallength', + 'imagenumber', + 'securityclassification', + 'imagehistory', + 'subjectlocation', + 'exposureindex', + 'sensingmethod', + 'filesource', + 'scenetype', + 'cfapattern', + 'customrendered', + 'exposuremode', + 'whitebalance', + 'digitalzoomratio', + 'focallengthin35mmformat', + 'scenecapturetype', + 'gaincontrol', + 'contrast', + 'saturation', + 'sharpness', + 'subjectdistancerange', + 'gamma' + ); + +$startTime = microtime(true); +for ($i = 0; $i < 1000; $i++) +{ + $lowerDataArray = array_change_key_case($array, CASE_LOWER); + foreach ($lowerDataArray as $key => $value) + { + $str2 = $key; + } +} +$endTime = microtime(true); +echo ($endTime - $startTime).'<br />'; + + +$startTime = microtime(true); +for ($i = 0; $i < 1000; $i++) +{ + foreach ($lowerDataArray as $key => $value) + { + $key = strtolower($key); + $str2 = $key; + } +} +$endTime = microtime(true); +echo ($endTime - $startTime).'<br />'; + +/** +0.0651071071625 +0.119043111801 + +0.0651071071625 +0.119043111801 + +0.0670680999756 +0.122123003006 + */ + +?> \ No newline at end of file Deleted: trunk/misc/benchmark/perf.php =================================================================== --- trunk/misc/benchmark/perf.php 2008-04-06 21:38:41 UTC (rev 4916) +++ trunk/misc/benchmark/perf.php 2008-04-06 21:40:37 UTC (rev 4917) @@ -1,25 +0,0 @@ -<?php -define('LINPHA_DIR','../../linpha2'); - -if (!file_exists(LINPHA_DIR.'/logsql.txt')) -{ - die("To enable sql logging create the file linpha/logsql.txt"); -} - -include_once(LINPHA_DIR.'/lib/include/common.php'); - -/** - * some init stuff - */ - require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - global $linpha; - $linpha = new Linpha(); - $linpha->sql->startSession(); - -/** - * do perf - */ - $perf = &NewPerfMonitor($GLOBALS['linpha']->db); - define('ADODB_PERF_NO_RUN_SQL',1); - $perf->UI($pollsecs=5); -?> \ No newline at end of file Added: trunk/misc/benchmark/stringConcatvsArrayJoin.php =================================================================== --- trunk/misc/benchmark/stringConcatvsArrayJoin.php (rev 0) +++ trunk/misc/benchmark/stringConcatvsArrayJoin.php 2008-04-06 21:40:37 UTC (rev 4917) @@ -0,0 +1,52 @@ +<?php +$startTime = microtime(true); +$str1 = ''; +for($i = 0; $i < 100000; $i++) +{ + $str1 .= 'test'; +} +$str2 = $str1; +$endTime = microtime(true); +echo ($endTime - $startTime).'<br />'; + + +$startTime = microtime(true); +$array = array(); +for($i = 0; $i < 100000; $i++) +{ + $array[] = 'test'; +} +$str2 = implode('', $array); + +$endTime = microtime(true); +echo ($endTime - $startTime).'<br />'; + + +$startTime = microtime(true); +$array = array(); +for($i = 0; $i < 100000; $i++) +{ + $array[] = 'test'; +} +$str2 = implode(', ', $array); + +$endTime = microtime(true); +echo ($endTime - $startTime).'<br />'; + +/** +0.0420918464661 +0.0726561546326 +0.0897808074951 + +0.0410449504852 +0.0717570781708 +0.0952560901642 + +0.0391261577606 +0.075886964798 +0.0970549583435 + +interesting... +in javascript, its exactly the opposite + */ +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |