com presentations: Tweak: devs19.html devs19.xml
[email protected] (Rasmus Lerdorf) Mon, 20 May 2019 17:42:00 +0000
| Newsgroups | php.pres |
|---|---|
| Message-ID | <[email protected]> |
Commit: 288d9619cba09cc133367beb9d47aca143106f93 Author: Rasmus Lerdorf <[email protected]> Mon, 20 May 2019 10:42:00 -0700 Parents: 26c79292f51bec5606a20627819cff13b0bc6b60 Branches: master Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=288d9619cba09cc133367beb9d47aca143106f93 Log: Tweak Changed paths: M devs19.html M devs19.xml Diff: diff --git a/devs19.html b/devs19.html index 36b0cbe..b805b87 100644 --- a/devs19.html +++ b/devs19.html @@ -381,140 +381,6 @@ array_key_exists($needle, $haystack); strchr($haystack, $needle);</code></pre> </section> </section> <section> - <section id="dce"> - <p class="p" style="font-size:2em;text-align:center;">Dead Code Elimination (DCE)</p> - <p class="p" style="font-size:1.5em;text-align:center;">Escape Analysis</p> - <p class="p" style="font-size:1.4em;text-align:center;">Sparse Conditional Constant Propagation</p> - </section> -<section id="dce0"> - <pre><code class="result nohighlight" data-trim style="font-size:0.9em;" >php -d opcache.optimization_level=-1 -d opcache.opt_debug_level=0x20000 script</code></pre> - <pre><code data-trim style="font-size:1.05em;" >function fn() { - $a = 1; - return 0; -}</code></pre> - <p class="p" style="font-size:1.1em;text-align:left;">PHP 7.1</p> - <pre><code class="result nohighlight" data-trim style="font-size:1em;" >fn: (lines=2, args=0, vars=1, tmps=0) -L0: ASSIGN CV0($a) int(1) -L1: RETURN int(0)</code></pre> - <p class="p" style="font-size:1.1em;text-align:left;">PHP 7.2/7.3</p> - <pre><code class="result nohighlight" data-trim style="font-size:1em;" >fn: (lines=1, args=0, vars=0, tmps=0) -L0: RETURN int(0)</code></pre> - </section> -<section id="dce1"> - <pre><code data-trim style="font-size:1.05em;" >function foo(string $s1, string $s2, string $s3, string $s4) { - $x = ($s1 . $s2) . ($s3 . $s4); - $x = 0; - return $x; -}</code></pre> - <pre><code class="result nohighlight" data-trim style="font-size:1em;" >PHP 7.1 PHP 7.2/7.3 -foo: (lines=10, args=4, vars=5, tmps=3) foo: (lines=5, args=4, vars=4, tmps=0) -L0: CV0($s1) = RECV 1 L0: CV0($s1) = RECV 1 -L1: CV1($s2) = RECV 2 L1: CV1($s2) = RECV 2 -L2: CV2($s3) = RECV 3 L2: CV2($s3) = RECV 3 -L3: CV3($s4) = RECV 4 L3: CV3($s4) = RECV 4 -L4: T6 = CONCAT CV0($s1) CV1($s2) L4: RETURN int(0) -L5: T7 = CONCAT CV2($s3) CV3($s4) -L6: T5 = CONCAT T6 T7 -L7: ASSIGN CV4($x) T5 -L8: ASSIGN CV4($x) int(0) -L9: RETURN CV4($x)</code></pre> - </section> -<section id="dce2"> - <p class="p" style="font-size:1.1em;text-align:left;">Try to trick it</p> - <pre><code data-trim style="font-size:1.05em;" >function foo($a) { - $b = $a += 3; - return $a; -}</code></pre> - <p class="p" style="font-size:1.1em;text-align:left;">PHP 7.2/7.3</p> - <pre><code class="result nohighlight" data-trim style="font-size:1em;" >foo: (lines=3, args=1, vars=1, tmps=1) -L0: CV0($a) = RECV 1 -L1: ASSIGN_ADD CV0($a) int(3) -L2: RETURN CV0($a)</code></pre> - </section> -<section id="dce3"> - <p class="p" style="font-size:1.1em;text-align:left;">But...</p> - <pre><code data-trim style="font-size:1.05em;" >function foo(int $x, int $y) { - $a = [$x]; - $a[1] = $y; - $a = $y; - return $a; -}</code></pre> - <pre><code class="result nohighlight" data-trim style="font-size:1em;" >PHP 7.2 PHP 7.3 -foo: (lines=7, args=2, vars=3, tmps=1) foo: (lines=4, args=2, vars=3, tmps=0) -L0: CV0($x) = RECV 1 L0: CV0($x) = RECV 1 -L1: CV1($y) = RECV 2 L1: CV1($y) = RECV 2 -L2: CV2($a) = INIT_ARRAY 1 CV0($x) NEXT L2: CV2($a) = QM_ASSIGN CV1($y) -L3: ASSIGN_DIM CV2($a) int(1) L3: RETURN CV2($a) -L4: OP_DATA CV1($y) -L5: ASSIGN CV2($a) CV1($y) -L6: RETURN CV2($a)</code></pre> - </section> -<section id="dce4"> - <pre><code data-trim style="font-size:1.05em;" >class A { } -function foo(int $x) { - $a = new A; - $a->foo = $x; - return $x; -}</code></pre> - <p class="p" style="font-size:1.1em;text-align:left;">PHP 7.3</p> - <pre><code class="result nohighlight" data-trim style="font-size:1.05em;" >foo: (lines=2, args=1, vars=1, tmps=0) -L0: CV0($x) = RECV 1 -L1: RETURN CV0($x)</code></pre> - </section> -<section id="dce5"> - <pre><code data-trim style="font-size:1.05em;" >class A { - function __destruct() {} -} -function foo(int $x) { - $a = new A; - $a->foo = $x; - return $x; -}</code></pre> - <p class="p" style="font-size:1.1em;text-align:left;">PHP 7.3</p> - <pre><code class="result nohighlight" data-trim style="font-size:1.05em;" >foo: (lines=7, args=1, vars=2, tmps=1) -L0: CV0($x) = RECV 1 -L1: V2 = NEW 0 string("A") -L2: DO_FCALL -L3: CV1($a) = QM_ASSIGN V2 -L4: ASSIGN_OBJ CV1($a) string("foo") -L5: OP_DATA CV0($x) -L6: RETURN CV0($x)</code></pre> - </section> -<section id="dce6"> - <pre><code data-trim style="font-size:1.05em;" >function foo(int $x) { - if ($x) { - $a = [0,1]; - } else { - $a = [0,2]; - } - return $a[0]; -}</code></pre> - <p class="p" style="font-size:1.1em;text-align:left;">PHP 7.3</p> - <pre><code class="result nohighlight" data-trim style="font-size:1.05em;" >foo: (lines=2, args=1, vars=1, tmps=0) -L0: CV0($x) = RECV 1 -L1: RETURN int(0)</code></pre> - </section> -<section id="dce7"> - <pre><code data-trim style="font-size:1.05em;" >function foo() { - $o = new stdClass(); - $o->foo = 0; - $i = 1; - $c = $i < 2; - if ($c) { - $k = 2 * $i; - $o->foo = $i; - echo $o->foo; - } - $o->foo += 2; - $o->foo++; - return $o->foo; -}</code></pre> - <p class="p" style="font-size:1.1em;text-align:left;">PHP 7.3</p> - <pre><code class="result nohighlight" data-trim style="font-size:1.05em;" >foo: (lines=2, args=0, vars=0, tmps=0) -L0: ECHO int(1) -L1: RETURN int(4)</code></pre> - </section> </section> - <section> <section id="wpbench"> <div id="wpbench_container" class="stretch" style="margin: 0 auto"></div> diff --git a/devs19.xml b/devs19.xml index 5bc8b91..1533d92 100644 --- a/devs19.xml +++ b/devs19.xml @@ -34,7 +34,6 @@ <slide>slides/intro/eco.xml</slide> <slide>slides/intro/wwht2.xml</slide> <slide>slides/intro/wwht1.xml</slide> -<slide>slides/intro/dce2018.xml</slide> <slide>slides/intro/wp2018.xml</slide> <slide>slides/intro/smemwp2018.xml</slide> <slide>slides/intro/supported.xml</slide>