com presentations: more tuning: confoo16a.html slides/intro/php 7_tuning.xml

[email protected] (Rasmus Lerdorf) Tue, 23 Feb 2016 07:20:55 +0000
Newsgroups php.pres
Message-ID <[email protected]>
Commit:    123fdb70c3017dc3653bd095e4e7ab56ddd5d25c
Author:    Rasmus Lerdorf <[email protected]>         Mon, 22 Feb 2016 23:20:55 -0800
Parents:   eb02969c5a6b672df577022c57666576b2550561
Branches:  master

Link:       http://git.php.net/?p=presentations.git;a=commitdiff;h=123fdb70c3017dc3653bd095e4e7ab56ddd5d25c

Log:
more tuning

Changed paths:
  M  confoo16a.html
  M  slides/intro/php7_tuning.xml


Diff:
diff --git a/confoo16a.html b/confoo16a.html
index 8d72292..61456e8 100644
--- a/confoo16a.html
+++ b/confoo16a.html
@@ -603,6 +603,22 @@ drwxr-xr-x 26 root   root   4096 Feb  7 19:40 ..
 lrwxrwxrwx  1 root   root     14 Feb 23 02:47 current -&gt; /var/www/A
 drwxrwxr-x 25 apache apache  640 Feb 11 22:04 A
 drwxrwxr-x 25 apache apache  640 Feb 11 22:04 B</code></pre>
+		</section>
+<section id="php7_tune_app">
+		<p class="p" style="font-size:2em;">Application-level changes?</p>
+<p class="example">Remember this?</p>
+		<pre><code data-trim style="font-size:1.1em;">$a = [];
+for($i=0; $i &lt; 100000;$i++) {
+    $a[] = ['abc','def','ghi','jkl','mno','pqr'];
+}
+echo memory_get_usage(true);
+
+// PHP 5.x  109M
+// PHP 7.0   42M no opcache
+// PHP 7.0    6M with opcache enabled</code></pre>
+<p class="example">Use it!</p>
+		<pre><code data-trim style="font-size:1.1em;">include 'config.php'; // $config = [ ... ]</code></pre>
+		<pre><code data-trim style="font-size:1.1em;">include 'countries.php'; // $countries = [ 'CA'=&gt;'Canada', ... ]</code></pre>
 		</section>	</section>
 	<section>
 		<section id="numa">
diff --git a/slides/intro/php7_tuning.xml b/slides/intro/php7_tuning.xml
index 63d4cc9..b309c73 100644
--- a/slides/intro/php7_tuning.xml
+++ b/slides/intro/php7_tuning.xml
@@ -63,4 +63,27 @@ drwxrwxr-x 25 apache apache  640 Feb 11 22:04 A
 drwxrwxr-x 25 apache apache  640 Feb 11 22:04 B
 ]]></example>
 
+<break lines="1" section="php7_tune_app"/>
+<blurb fontsize="2em">Application-level changes?</blurb>
+<example fontsize="1.1em" result='0' title="Remember this?"><![CDATA[
+<?php
+$a = [];
+for($i=0; $i < 100000;$i++) {
+    $a[] = ['abc','def','ghi','jkl','mno','pqr'];
+}
+echo memory_get_usage(true);
+
+// PHP 5.x  109M
+// PHP 7.0   42M no opcache
+// PHP 7.0    6M with opcache enabled
+]]></example>
+
+<example fontsize="1.1em" result='0' title="Use it!"><![CDATA[
+include 'config.php'; // $config = [ ... ]
+]]></example>
+
+<example fontsize="1.1em" result='0' title=""><![CDATA[
+include 'countries.php'; // $countries = [ 'CA'=>'Canada', ... ]
+]]></example>
+
 </slide>