Skip to content

Commit 3ed4119

Browse files
committed
Improve performance drastically by updating phpllvm
1 parent a729d41 commit 3ed4119

File tree

7 files changed

+66
-19
lines changed

7 files changed

+66
-19
lines changed

Docker/dev/ubuntu-16.04/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ RUN git clone https://github.com/nikic/php-ast . && \
2323
make && \
2424
make install
2525

26+
WORKDIR ../sample_prof
27+
RUN git clone https://github.com/nikic/sample_prof.git . && \
28+
phpize && \
29+
./configure && \
30+
make && \
31+
make install
32+
2633
COPY php.ini /usr/local/lib/php.ini
2734

2835
RUN curl --silent --show-error https://getcomposer.org/installer | php -- --no-ansi --install-dir=/usr/local/bin --filename=composer

Docker/dev/ubuntu-16.04/php.ini

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
memory_limit=-1
22
extension=ast.so
3+
extension=sample_prof.so

benchmarks/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ Each example includes a benchmark that compares each mode of operation to just r
1010

1111
| Test Name | 7.4 (s)| bin/jit.php (s) | bin/compile.php (s) | compiled time (s) |
1212
|--------------------|-------------------|-----------------|---------------------|-------------------|
13-
| Ack(3,10) | 1.9212 | 0.8305 | 0.6508 | 0.1548 |
14-
| Ack(3,8) | 0.1005 | 0.6248 | 0.6501 | 0.0115 |
15-
| Ack(3,9) | 0.3677 | 0.6654 | 0.6507 | 0.0383 |
16-
| fibo(30) | 0.0876 | 0.6213 | 0.6543 | 0.0085 |
17-
| fibo(32) | 0.2082 | 0.6383 | 0.6514 | 0.0197 |
18-
| mandelbrot | 0.1556 | 0.6465 | 0.6618 | 0.0148 |
19-
| simple | 0.0640 | 0.6362 | 0.6540 | 0.0117 |
13+
| Ack(3,10) | 1.9183 | 0.4112 | 0.2330 | 0.1654 |
14+
| Ack(3,8) | 0.1006 | 0.2105 | 0.2337 | 0.0115 |
15+
| Ack(3,9) | 0.3685 | 0.2519 | 0.2339 | 0.0403 |
16+
| fibo(30) | 0.0880 | 0.2071 | 0.2325 | 0.0083 |
17+
| fibo(32) | 0.2091 | 0.2221 | 0.2334 | 0.0192 |
18+
| mandelbrot | 0.1574 | 0.2302 | 0.2451 | 0.0135 |
19+
| simple | 0.0641 | 0.2156 | 0.2363 | 0.0114 |
2020

2121
<!-- benchmark table end -->

bin/profiled/compile.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
sample_prof_start(50); // start profiler with 50 usec interval
4+
require __DIR__ . '/../compile.php'; // run script here
5+
sample_prof_end(); // disable profiler
6+
$data = sample_prof_get_data(); // retrieve profiling data
7+
8+
foreach ($data as $file => $lines) {
9+
echo "In file $file:\n";
10+
foreach ($lines as $line => $hits) {
11+
echo "Line $line hit $hits times.\n";
12+
}
13+
}

bin/profiled/jit.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
sample_prof_start(10); // start profiler with 50 usec interval
4+
require __DIR__ . '/../jit.php'; // run script here
5+
sample_prof_end(); // disable profiler
6+
$data = sample_prof_get_data(); // retrieve profiling data
7+
8+
foreach ($data as $file => $lines) {
9+
echo "In file $file:\n";
10+
foreach ($lines as $line => $hits) {
11+
echo "Line $line hit $hits times.\n";
12+
}
13+
}

bin/profiled/vm.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
sample_prof_start(50); // start profiler with 50 usec interval
4+
require __DIR__ . '/../vm.php'; // run script here
5+
sample_prof_end(); // disable profiler
6+
$data = sample_prof_get_data(); // retrieve profiling data
7+
8+
foreach ($data as $file => $lines) {
9+
echo "In file $file:\n";
10+
foreach ($lines as $line => $hits) {
11+
echo "Line $line hit $hits times.\n";
12+
}
13+
}

composer.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)