cvs: presentations /slides/hpp Benchmark_RandomData.inc WordFactory.inc advice.xml bad_regex_apd.php benchmarking.xml dynamic_activation.xml
extending_bi.xml gen_trace.xml interp_trace.xml max.php max2.php persistant.xml persistant1.xml prof_apd.xml prof_tools.xml profiling.xml
recoding_c.xml serendipity_example.xml setup_apd.xml setup_bi.xml simple_example.xml textstatistics.xml truisms.xml

From: Date: Mon, 28 Apr 2003 21:32:12 +0000
Subject: cvs: presentations /slides/hpp Benchmark_RandomData.inc WordFactory.inc advice.xml bad_regex_apd.php benchmarking.xml dynamic_activation.xml
extending_bi.xml gen_trace.xml interp_trace.xml max.php max2.php persistant.xml persistant1.xml prof_apd.xml prof_tools.xml profiling.xml
recoding_c.xml serendipity_example.xml setup_apd.xml setup_bi.xml simple_example.xml textstatistics.xml truisms.xml
Groups: php.pres 
Request: Send a blank email to pres+get-669@lists.php.net to get a copy of this message
sterling Mon Apr 28 17:32:12 2003 EDT Added files: /presentations/slides/hpp Benchmark_RandomData.inc WordFactory.inc bad_regex_apd.php extending_bi.xml gen_trace.xml interp_trace.xml max.php max2.php persistant.xml persistant1.xml prof_apd.xml prof_tools.xml setup_apd.xml setup_bi.xml textstatistics.xml truisms.xml Modified files: /presentations/slides/hpp advice.xml benchmarking.xml dynamic_activation.xml profiling.xml recoding_c.xml serendipity_example.xml simple_example.xml Log: add new files, remove old files, change some files

Index: presentations/slides/hpp/advice.xml diff -u presentations/slides/hpp/advice.xml:1.1 presentations/slides/hpp/advice.xml:1.2 --- presentations/slides/hpp/advice.xml:1.1 Mon Apr 28 16:20:02 2003 +++ presentations/slides/hpp/advice.xml Mon Apr 28 17:32:12 2003 @@ -1,6 +1,6 @@ <slide title="Advice"> -<blurb>Advice</blurb> -<blurb>Never recode a PHP distribution function unless your patch is accepted into PHP</blurb> -<blurb>Be aware of the increased maintenance needs</blurb> -<image filename="10000000000000690000004538A678CE.jpg" /> -</slide> \ No newline at end of file +<image filename="10000000000000690000004538A678CE.jpg" align="right"/> +<blurb><![CDATA[<br/><br/><br/>]]></blurb> +<blurb fontsize="3.5em" marginleft="4.0em">Never recode a PHP distribution function unless your patch is accepted into PHP</blurb> +<blurb fontsize="3.5em" marginleft="4.0em">Be aware of the increased maintenance needs</blurb> +</slide> Index: presentations/slides/hpp/benchmarking.xml diff -u presentations/slides/hpp/benchmarking.xml:1.1 presentations/slides/hpp/benchmarking.xml:1.2 --- presentations/slides/hpp/benchmarking.xml:1.1 Mon Apr 28 16:20:02 2003 +++ presentations/slides/hpp/benchmarking.xml Mon Apr 28 17:32:12 2003 @@ -1,5 +1,5 @@ <slide title="Benchmarking"> -<blurb>Benchmarking</blurb> -<blurb>Benchmarking allows us to compare alternative implementations in a sandboxed environment.</blurb> -<image filename="100000000000005C0000005C29D61F11.jpg" /> -</slide> \ No newline at end of file +<image filename="100000000000005C0000005C29D61F11.jpg" align="right"/> +<blurb><![CDATA[<br/><br/><br/><br/>]]></blurb> +<blurb fontsize="3.5em" align="center">Benchmarking allows us to compare alternative implementations in a sandboxed environment.</blurb> +</slide> Index: presentations/slides/hpp/dynamic_activation.xml diff -u presentations/slides/hpp/dynamic_activation.xml:1.1 presentations/slides/hpp/dynamic_activation.xml:1.2 --- presentations/slides/hpp/dynamic_activation.xml:1.1 Mon Apr 28 16:20:02 2003 +++ presentations/slides/hpp/dynamic_activation.xml Mon Apr 28 17:32:12 2003 @@ -1,6 +1,9 @@ <slide title="Dynamic Activation"> -<blurb>Dynamic Activation</blurb> -<blurb>if($_GET[?debug?] == 1) {</blurb> -<blurb>}</blurb> -<image filename="100000000000005C0000005C29D61F11.jpg" /> -</slide> \ No newline at end of file +<image filename="100000000000005C0000005C29D61F11.jpg" align="right"/> +<blurb><![CDATA[<br/><br/>]]></blurb> +<example><![CDATA[<?php +if($_GET['debug'] == 1) { + // .. debug code ... +} +?>]]></example> +</slide> Index: presentations/slides/hpp/profiling.xml diff -u presentations/slides/hpp/profiling.xml:1.1 presentations/slides/hpp/profiling.xml:1.2 --- presentations/slides/hpp/profiling.xml:1.1 Mon Apr 28 16:20:02 2003 +++ presentations/slides/hpp/profiling.xml Mon Apr 28 17:32:12 2003 @@ -1,7 +1,9 @@ <slide title="Profiling"> -<blurb>Profiling</blurb> -<blurb>Identify Bottlenecks</blurb> -<blurb>Track Resource Usage</blurb> -<blurb>Generate Call Trees</blurb> -<image filename="100000000000005C0000005C29D61F11.jpg" /> -</slide> \ No newline at end of file +<image filename="100000000000005C0000005C29D61F11.jpg" align="right"/> +<blurb><![CDATA[<br/><br/><br/>]]></blurb> +<list marginleft="2.0em"> +<bullet fontsize="4.0em">Identify Bottlenecks</bullet> +<bullet fontsize="4.0em">Track Resource Usage</bullet> +<bullet fontsize="4.0em">Generate Call Trees</bullet> +</list> +</slide> Index: presentations/slides/hpp/recoding_c.xml diff -u presentations/slides/hpp/recoding_c.xml:1.1 presentations/slides/hpp/recoding_c.xml:1.2 --- presentations/slides/hpp/recoding_c.xml:1.1 Mon Apr 28 16:20:02 2003 +++ presentations/slides/hpp/recoding_c.xml Mon Apr 28 17:32:12 2003 @@ -1,5 +1,5 @@ <slide title="Recoding in C"> -<blurb>Recoding in C</blurb> -<blurb>The ?ultimate step? when an routine can not be re-implemented using a different algorithm.</blurb> -<image filename="10000000000000690000004538A678CE.jpg" /> -</slide> \ No newline at end of file +<image filename="10000000000000690000004538A678CE.jpg" align="right"/> +<blurb><![CDATA[<br/><br/><br/>]]></blurb> +<blurb fontsize="3.5em" align="center">The ultimate step when an routine can not be re-implemented using a different algorithm.</blurb> +</slide> Index: presentations/slides/hpp/serendipity_example.xml diff -u presentations/slides/hpp/serendipity_example.xml:1.1 presentations/slides/hpp/serendipity_example.xml:1.2 --- presentations/slides/hpp/serendipity_example.xml:1.1 Mon Apr 28 16:20:02 2003 +++ presentations/slides/hpp/serendipity_example.xml Mon Apr 28 17:32:12 2003 @@ -1,5 +1,4 @@ <slide title="Serendipity Example"> -<blurb>Serendipity Example</blurb> +<image filename="100000000000005C0000005C29D61F11.jpg" align="right"/> <blurb>(pprof.serendipity)</blurb> -<image filename="100000000000005C0000005C29D61F11.jpg" /> -</slide> \ No newline at end of file +</slide> Index: presentations/slides/hpp/simple_example.xml diff -u presentations/slides/hpp/simple_example.xml:1.1 presentations/slides/hpp/simple_example.xml:1.2 --- presentations/slides/hpp/simple_example.xml:1.1 Mon Apr 28 16:20:02 2003 +++ presentations/slides/hpp/simple_example.xml Mon Apr 28 17:32:12 2003 @@ -1,6 +1,7 @@ <slide title="Simple example"> -<blurb>Simple example</blurb> -<blurb>Let?s try and actually measure the difference between PHP and C function implementations. </blurb> -<blurb>(max.php)</blurb> -<image filename="100000000000005C0000005C29D61F11.jpg" /> -</slide> \ No newline at end of file +<image filename="100000000000005C0000005C29D61F11.jpg" align="right"/> +<blurb> +</blurb> +<blurb>Let's try and actually measure the difference between PHP and C function implementations. </blurb> +<example filename="max.php" fontsize="1.8em"/> +</slide> Index: presentations/slides/hpp/Benchmark_RandomData.inc +++ presentations/slides/hpp/Benchmark_RandomData.inc <?php require_once "Benchmark/Iterate.php"; class Benchmark_RandomData extends Benchmark_Iterate { function run() { $arguments = func_get_args(); $iterations = array_shift($arguments); $function_name = array_shift($arguments); $data_func = array_shift($arguments); for ($i = 1; $i <= $iterations; $i++) { $data = call_user_func_array($data_func, $arguments); $this->setMarker('start_' . $i); call_user_func_array($function_name, $data); $this->setMarker('end_' . $i); } } } ?> Index: presentations/slides/hpp/WordFactory.inc +++ presentations/slides/hpp/WordFactory.inc <?php require_once "Text/Word.inc"; class WordFactory { static $objects; function Word($name) { $nobject = &self::$objects['Word'][$name]; if (!$nobject) { $nobject = new Word($name); } return $nobject; } } ?> Index: presentations/slides/hpp/bad_regex_apd.php +++ presentations/slides/hpp/bad_regex_apd.php <?php include_once("bad_regex.php"); apd_set_pprof_trace(); $file = file_get_contents($argv[1]); if (($match = unsafe_html($file)) != false) { echo "File is unsafe\n"; echo "$match\n"; } else { echo "File is good\n"; } ?> Index: presentations/slides/hpp/extending_bi.xml +++ presentations/slides/hpp/extending_bi.xml <slide title="Extending Benchmark_Iterate"> <image filename="100000000000005C0000005C29D61F11.jpg" align="right" /> <blurb>We'll overload the run method of Benchmark_Iterate to allow for passing a data generation function.</blurb> <example title="Benchmark_RandomData.inc" filename="Benchmark_RandomData.inc" fontsize="1.6em"/> <example title="max2.php" filename="max2.php" fontsize="1.6em"/> </slide> Index: presentations/slides/hpp/gen_trace.xml +++ presentations/slides/hpp/gen_trace.xml <slide title="Generating A Trace"> <image filename="100000000000005C0000005C29D61F11.jpg" align="right"/> <blurb><![CDATA[<br/><br/>]]></blurb> <example filename="bad_regex_apd.php" fontsize="1.7em"/> </slide> Index: presentations/slides/hpp/interp_trace.xml +++ presentations/slides/hpp/interp_trace.xml <slide title="Interpreting A trace"> <image filename="100000000000005C0000005C29D61F11.jpg" align="right"/> <blurb>(bad_regex.php.trace)</blurb> </slide> Index: presentations/slides/hpp/max.php +++ presentations/slides/hpp/max.php <?php require_once "Benchmark/Iterate.php"; $test_array = create_random_array(100); foreach(array('max', 'my_max') as $func) { $b = new Benchmark_Iterate; $b->run('10000', $func, $test_array); $result = $b->get(); print "$func\t"; printf("System + User Time: %1.6f\n", $result['mean']); } function create_random_array($size) { $array = array(); for($i=0; $i < $size; $i++) { $array[$i] = rand(); } return $array; } function my_max($array) { reset($array); $max = current($array); while( $el = next($array)) { if($el > $max) { $max = $el; } } return $max; } ?> Index: presentations/slides/hpp/max2.php +++ presentations/slides/hpp/max2.php <?php require_once "Benchmark_RandomData.inc"; foreach(array(10, 100, 1000) as $size) { print "Array size $size\n"; foreach(array('max', 'my_max') as $func) { $b = new Benchmark_RandomData; $b->run(100, $func, 'create_random_array', $size); $result = $b->get(); print "$func\t"; printf("System + User Time: %1.6f\n", $result['mean']); } } ?> Index: presentations/slides/hpp/persistant.xml +++ presentations/slides/hpp/persistant.xml <slide title="Persistant Cache"> <image filename="10000000000000690000004538A678CE.jpg" align="right"/> <blurb><![CDATA[<br/><br/><br/>]]></blurb> <list> <bullet>DBM</bullet> <bullet>RDBM</bullet> <bullet>Flat File</bullet> <bullet>Shared Memory (SYS V)</bullet> </list> </slide> Index: presentations/slides/hpp/persistant1.xml +++ presentations/slides/hpp/persistant1.xml <slide title="Persistant Cache (II)"> <image filename="10000000000000690000004538A678CE.jpg" align="right"/> <blurb><![CDATA[<br/><br/><br/>]]></blurb> <list> <bullet>DBMs and RDBMS support key-value pairs for easy storage of simple data</bullet> <bullet>Complex data requires serialization/deserialization</bullet> <bullet>Make sure your data is worth the trouble!</bullet> <bullet>PHP's %session% extension is a good example</bullet> </list> </slide> Index: presentations/slides/hpp/prof_apd.xml +++ presentations/slides/hpp/prof_apd.xml <slide title="Profiler Diagram (APD)"> <image marginleft="2.0em" filename="10000000000001C10000022ECC7E4B87.jpg" /> <blurb><![CDATA[<br/><br/><br/>]]></blurb> <list> <bullet>Intercepts calls to zend_execute</bullet> <bullet>Generates trace of functions calls with timings</bullet> </list> </slide> Index: presentations/slides/hpp/prof_tools.xml +++ presentations/slides/hpp/prof_tools.xml <slide title="Tools For Profiling"> <image filename="100000000000005C0000005C29D61F11.jpg" align="right"/> <blurb><![CDATA[<br/><br/><br/>]]></blurb> <list marginleft="4.0em"> <bullet>DBG (%http://dd.cron.ru/dbg/%)</bullet> <bullet>APD (PECL)</bullet> <bullet>Xdebug (%http://xdebug.derickrethans.nl/%)</bullet> </list> </slide> Index: presentations/slides/hpp/setup_apd.xml +++ presentations/slides/hpp/setup_apd.xml <slide title="Setting up APD"> <blurb>Install APD via PEAR</blurb> <example type="shell"><![CDATA[]$ pear install apd ]$ cp apd.so /absolute/path/to/php_apd.so]]></example> <blurb>Then add the following to your %php.ini% file</blurb> <example>zend_extension = /absolute/path/to/php_apd.so</example> </slide> Index: presentations/slides/hpp/setup_bi.xml +++ presentations/slides/hpp/setup_bi.xml <slide title="Install Benchmark_Iterate"> <image filename="100000000000005C0000005C29D61F11.jpg" align="right"/> <blurb><![CDATA[<br/><br/><br/><br/>]]></blurb> <example type="shell">]$ pear install Benchmark_Iterate</example> <blurb fontsize="4.0em" align="center">It's that simple.</blurb> </slide> Index: presentations/slides/hpp/textstatistics.xml +++ presentations/slides/hpp/textstatistics.xml <slide title="Caching for Text_Statistics"> <image filename="10000000000000690000004538A678CE.jpg" align="right"/> <blurb>Text Statistics is a PEAR package to calculate statistics for documents including readability scores. One of its more intensive operations is calculating the number of syllables in a word, which is calculated through a number of regexps. We can improve its performance on moderate-large documents by caching word objects.</blurb> <example filename="WordFactory.inc" fontsize="1.7em"/> </slide> Index: presentations/slides/hpp/truisms.xml +++ presentations/slides/hpp/truisms.xml <slide title="Some Truisms"> <image filename="100000000000005C0000005C29D61F11.jpg" align="right"/> <blurb><![CDATA[<br/><br/><br/>]]></blurb> <list marginleft="2.0em"> <bullet fontsize="4.0em">Ahmdahl's Law</bullet> <bullet fontsize="4.0em">80/20 rule</bullet> </list> </slide>
« previous php.pres (#669) next »