cvs: presentations /slides/phpperform compress.xml cpuusage.xml cssoptimize.xml htmloptimize.xml httpoptimization.xml modgz.xml mrinf_gz.xml
mrinf_opt.xml optimize.xml perf_intr.xml phpgz.xml prf_fileio.xml prf_socket.xml prf_sqlquery.xml reduce.xml regex.xml serverfarm.jpg

From: Date: Sat, 02 Nov 2002 06:13:43 +0000
Subject: cvs: presentations /slides/phpperform compress.xml cpuusage.xml cssoptimize.xml htmloptimize.xml httpoptimization.xml modgz.xml mrinf_gz.xml
mrinf_opt.xml optimize.xml perf_intr.xml phpgz.xml prf_fileio.xml prf_socket.xml prf_sqlquery.xml reduce.xml regex.xml serverfarm.jpg
Groups: php.pres 
Request: Send a blank email to pres+get-466@lists.php.net to get a copy of this message
sterling Sat Nov 2 01:13:43 2002 EDT Added files: /presentations/slides/phpperform compress.xml cpuusage.xml cssoptimize.xml htmloptimize.xml httpoptimization.xml modgz.xml mrinf_gz.xml mrinf_opt.xml optimize.xml perf_intr.xml phpgz.xml prf_fileio.xml prf_socket.xml prf_sqlquery.xml reduce.xml regex.xml serverfarm.jpg Log: add slides and shiznit for the presentation...

Index: presentations/slides/phpperform/compress.xml +++ presentations/slides/phpperform/compress.xml <slide title="Compress"> <blurb> HTTP supports native compression by using Lempel-Ziv encoding (LZ77). Its the same encoding mechanism used by the popular unix tool &lt;code>gzip&lt;/code>. </blurb> <list title="Compression Advantages"> <bullet effect="slide">Greatly reduces bandwidth</bullet> <bullet effect="slide">Cross browser compliant</bullet> <bullet effect="slide">Compression can cache as well</bullet> </list> <list title="Compression Disadvantages"> <bullet effect="slide">CPU intensive on the Server</bullet> <bullet effect="slide">CPU intensive on the Client</bullet> </list> </slide> Index: presentations/slides/phpperform/cpuusage.xml +++ presentations/slides/phpperform/cpuusage.xml <slide title="CPU Usage"> <list> <bullet>Avoid Using frequent array accesses, remember, each array access is a hash lookup.</bullet> </list> <example fontsize="1.2em" title="The Wrong Way"><![CDATA[<?php $ar['name'] = 'Sterling'; for ($i = 0; $i < 20; ++$i) { print $ar['name']; } ?>]]> </example> <list> <bullet>Shorten "required" executions, such as loops.</bullet> <bullet>Avoid rebuilding large data structures.</bullet> <bullet>Look for alternatives to regular expressions</bullet> </list> </slide> Index: presentations/slides/phpperform/cssoptimize.xml +++ presentations/slides/phpperform/cssoptimize.xml <slide title="CSS Optimization"> <list> <bullet>Use CSS instead of incessant &lt;font> tag usage</bullet> <bullet>All CSS should be contained in an external file that can be cached.</bullet> <bullet>Use short names for CSS attributes</bullet> <bullet>Override global html tag attributes using CSS properties</bullet> <bullet>Use CSS to control table definitions with CSS v2...</bullet> </list> <example fontsize="1.2em"><![CDATA[<STYLE TYPE="text/css"> <-- TABLE {table-layout:fixed; width: 100%} #fixed COL {width: 50%} --> </STYLE> <TABLE> <COL><COL> <TR><TD>Cell 1</TD><TD>Cell 2</TD></TR> <TR><TD>Cell 3</TD><TD>Cell 3</TD></TR> </TABLE> ]]> </example> </slide> Index: presentations/slides/phpperform/htmloptimize.xml +++ presentations/slides/phpperform/htmloptimize.xml <slide title="HTML Optimization"> <list> <bullet>Remove All Comments!</bullet> <bullet>Meta tags don't work!</bullet> <bullet>Use parent html tags to specify child values, when all children have the same value</bullet> <bullet>Fully qualify links (ie, personal/images/ not personal/images)</bullet> </list> </slide> Index: presentations/slides/phpperform/httpoptimization.xml +++ presentations/slides/phpperform/httpoptimization.xml <slide title="HTTP Optimization"> <blurb title="URL Shortening"> By using Apache's &lt;i>mod_rewrite&lt;/i> module, you can greatly shorten your HTML files by making common locations into one/two letter aliases. </blurb> <example fontsize="1.2em" title="Apache Mod_Rewrite Entry"> <![CDATA[RewriteMap abbr dbm:/etc/apache/abbr RewriteRule ^/r/([^/]*)/?(.*) ${abbr:$1}$2 [redirect=permanent,last] ]]> </example> <example fontsize="1.2em" title="/etc/apache/abbr"> <![CDATA[ b bytes/ d dogs/ g graphics/ gt graphics/template/ ]]> </example> <blurb title="HTTP Caching"> Use HTTP headers to have finer grained control over browser caching, these headers include: </blurb> <example fontsize="1.2em" title="Headers"><![CDATA[Last-Modified: Mon, 22 Jul 2002 15:50:00 GMT Expires: Mon, 22 Jul 2002 15:52:25 GMT Cache-Control: must-revalidate, max-age=15, s-maxage=0, private]]> </example> </slide> Index: presentations/slides/phpperform/modgz.xml +++ presentations/slides/phpperform/modgz.xml <slide title="mod_gzip"> <blurb> Mod_gzip is a superb apache module which handles gzip compression and data caching. It offers signifigant increases in compression performance to the homebrewed PHP solutions. </blurb> <list title="mod_gzip features"> <bullet effect="slide">Compression statistics</bullet> <bullet effect="slide">The ability to chose compression via MIME type and Filename</bullet> <bullet effect="slide">You can exclude compression for certain browsers</bullet> <bullet effect="slide">Can cache compression results</bullet> </list> </slide> Index: presentations/slides/phpperform/mrinf_gz.xml +++ presentations/slides/phpperform/mrinf_gz.xml <slide title="More Information"> <link leader="mod_gzip Homepage: " href="http://www.remotecommunications.com/apache/mod_gzip/"/> </slide> Index: presentations/slides/phpperform/mrinf_opt.xml +++ presentations/slides/phpperform/mrinf_opt.xml <slide title="More Information"> <link fontsize="2.0em" leader="HTML Tidy: " href="http://www.w3.org/People/Raggett/tidy/"/> <link fontsize="2.0em" leader="Webreference HTML Optimization: " href="http://www.webreference.com/authoring/languages/html/optimize/"/> <link fontsize="2.0em" leader="HTTP Cache Explanation: " href="http://www.mnot.net/cache_docs/"/> </slide> Index: presentations/slides/phpperform/optimize.xml +++ presentations/slides/phpperform/optimize.xml <slide title="Optimize"> <list> <bullet effect="slide">Use preprocessors to eliminate whitespace</bullet> <bullet effect="slide">If you save 20 bytes per file, and have 1,000,000 hits a day, you've just saved 20,000,000 extra bytes</bullet> <bullet effect="slide">Send content "when ready," and use progressive images</bullet> </list> </slide> Index: presentations/slides/phpperform/perf_intr.xml +++ presentations/slides/phpperform/perf_intr.xml <slide title="Performance"> <blurb>So You Want to get performance from your php applications?</blurb> <divide/> <image filename="serverfarm.jpg" align="center" /> </slide> Index: presentations/slides/phpperform/phpgz.xml +++ presentations/slides/phpperform/phpgz.xml <slide title="PHP Compression"> <blurb> PHP supports output compression via PHP's ouput buffering features and the zlib extension. </blurb> <blurb> The simplest way is to use the &lt;code>ob_start ('ob_gzhandler')&lt;/code> or use the configuration options &lt;code>zlib.output_compression&lt;/code> and &lt;code>zlib.compression_level&lt;/code> </blurb> <blurb title="HTTP_Compress"> Alternatively, you can use PEAR's excellent HTTP_Compress class that will handle everything related to HTTP_Compression for you... </blurb> <example fontsize="1.2em" type="php"><![CDATA[<?php require_once 'HTTP/Compress.php'; HTTP_Compress::start (); print "Some data\n"; print "Some more data\n"; print "Even _more_ data\n"; HTTP_Compress::output (); ?>]]> </example> </slide> Index: presentations/slides/phpperform/prf_fileio.xml +++ presentations/slides/phpperform/prf_fileio.xml <slide title="File I/O"> <list title="File I/O Problems" fontsize="2.2em"> <bullet>Disk access is slower than memory access (duh!)</bullet> <bullet>Simultaeneous write/write operations cause data corruption. Therefore locking must occur.</bullet> <bullet>Locking is slow</bullet> </list> <list title="File I/O Tips" fontsize="2.2em"> <bullet effect="slide">Use the disk in concentrated bits, meaning do all your writing together.</bullet> <bullet effect="slide">Do Not Read Large Files Into Memory!</bullet> <bullet effect="slide">Do Not Read Small Files From Disk!</bullet> <bullet effect="slide">Employ caching to access frequently used data stored in memory</bullet> <bullet effect="slide">Try and put write operations where they will cause the least loss in user experience (remember, web pages are chunked!)</bullet> </list> </slide> Index: presentations/slides/phpperform/prf_socket.xml +++ presentations/slides/phpperform/prf_socket.xml <slide title="Sockets"> <list title="Performance Problems" fontsize="2.2em"> <bullet>Makes you network dependent (TCP/IP)</bullet> <bullet>Communication protocol overheads (TCP/IP, especially)</bullet> </list> <list title="Performance Tips" fontsize="2.2em"> <bullet effect="slide">When dealing with local sockets consider other options like pipes or shared memory.</bullet> <bullet effect="slide">Establishing a connection is the most costly part of the TCP/IP layer. Think carefully about re-using pre-existing connections.</bullet> <bullet effect="slide">When transfering large chunks of data, consider using a compression/encryption method to lower bandwidth</bullet> </list> </slide> Index: presentations/slides/phpperform/prf_sqlquery.xml +++ presentations/slides/phpperform/prf_sqlquery.xml <slide title="SQL Queries"> <list title="SQL Problems" fontsize="2.2em"> <bullet>Unused data is being pulled over a socket</bullet> <bullet>FULLTEXT indexes</bullet> <bullet>the LIKE clause</bullet> </list> <list title="SQL Tips" fontsize="2.2em"> <bullet effect="slide">Study and Learn Database Optimization</bullet> <bullet effect="slide">Failing that use the following tips...</bullet> <bullet effect="slide">MySQL supports the 'LIMIT' clause which can be used to lower the returned result set to a specified number</bullet> <bullet effect="slide">Never use LIKE or a FULLTEXT index to do complex searches. Use keywords and an alternative ranking system</bullet> <bullet effect="slide">The only thing worse than using a LIKE clause, is building your own LIKE clause in PHP.</bullet> </list> </slide> Index: presentations/slides/phpperform/reduce.xml +++ presentations/slides/phpperform/reduce.xml <slide title="Reducing Output"> <list title="Less output is good because..."> <bullet effect="slide">Saves server bandwidth</bullet> <bullet effect="slide">Decreases server CPU and Memory usage (well, kinda)</bullet> <bullet effect="slide">Has the same effect on the client side</bullet> <bullet effect="slide">On large sites, bandwidth is most often the most costly bottleneck</bullet> </list> </slide> Index: presentations/slides/phpperform/regex.xml +++ presentations/slides/phpperform/regex.xml <slide title="Regular Expressions"> <blurb title="Slow Regexps"> Its often beneficial to replace regular expressions with simpler functions that have the same effect. </blurb> <example fontsize="1.2em" title="With Regular Expression"><![CDATA[<?php if (preg_match ('/(.*)\@(.*)/', $data, $matches)) { print $matches[2]; } ?>]]></example> <example fontsize="1.2em" title="Without Regular Expressions"><![CDATA[<?php $pos = strrpos ('@', $data); if ($pos !== false) { print substr ($data, $pos); } ?>]]></example> <blurb title="Fast Regexps"> In other cases it may help to use regular expressions instead of custom parse routines in your PHP code. </blurb> </slide>
« previous php.pres (#466) next »