PHP coding help to boost Xenforo PHP Performance Via PGO training

eva2000

Well-known member
I am not a PHP coder, so posting this hear in hopes of some folks being interested in helping to boost Xenforo PHP 7+ performance via Profile Guided Optimization training. @Chris D @Kier @Mike @Jake Bunce @MattW @Brent W @Xon @Andy.N @DeltaHF @CarpCharacin @BoostN @SneakyDave @NixFifty @Steve F @Russ might be interested in this to see how far you can improve Xenforo's PHP 7+ performance via PGO training :)

My Centmin Mod LEMP stack supports optional end user selectable building of PHP 7+ with PGO so looking to see if Xenforo PHP performance can be improved via PGO training. With PGO training PHP 7+ builds can be up to 10-25% faster from my recent PHP 7.3 vs 7.2 vs 7.1 vs 7.0 benchmarks 😎

The PGO tuned numbers are when I specifically did PGO training for one of the benchmark scripts improving performance by up to 25% for that specific script which had regressed in performance prior.

189124

technique called Profile-Guided Optimization or PGO. The basic idea is as follows: When any program is compiled, the compiler uses some heuristics to determine the most likely path your program will take through the code, and optimizes the code using those assumptions.

PGO lets you train the compiler to produce a more optimized result. It does this by first compiling the code with instrumentation, then run the instrumented code which creates a profile. The final step is to recompile the program, using the profile to fine-tune the optimizations.

So what I need help with is extending the existing Intel provided PGO training scripts which are for mediawiki, wordpress and druapl code paths at https://github.com/centminmod/php_pgo_training_scripts with Xenforo 1.5/2.0/2.1 specific PHP code paths/functions commonly used. So that at PHP 7+ compilation time, I can PGO train the compiler to produce optimal Xenforo specific optimizations when building PHP 7+ :)

Running the PGO training script would then also run Xenforo specific code benchmark tests too. Here's existing output when you run PGO training scripts

Bash:
                -=- init Database(s) -=-
Database pgo_train succesfully dropped
Database pgo_train created succesfully
Created tables in pgo_train

                -=- Existing Databases -=-
information_schema
mysql
performance_schema
pgo_train
Content-type: text/html; charset=UTF-8

Hash benchmark module loaded!
MySQL benchmark module loaded!
Date benchmark module loaded!
String benchmark module loaded!
Standard benchmark module loaded!
Class benchmark module loaded!

--------------------------------
-   Benchmark timing results   -
--------------------------------
1.run_hash                 0.055
2.run_hash                 0.055
3.run_hash                 0.055
4.run_hash                 0.055
--------------------------------
1.run_mysql_queries        0.020
2.run_mysql_queries        0.018
3.run_mysql_queries        0.019
4.run_mysql_queries        0.018
--------------------------------
1.run_time                 0.002
2.run_time                 0.002
3.run_time                 0.002
4.run_time                 0.002
--------------------------------
1.run_string               0.012
2.run_string               0.012
3.run_string               0.012
4.run_string               0.012
--------------------------------
1.run_standard             0.016
2.run_standard             0.016
3.run_standard             0.016
4.run_standard             0.016
--------------------------------
1.run_class                0.001
2.run_class                0.001
3.run_class                0.001
4.run_class                0.001
--------------------------------
Total                      0.418

Though it isn't 100% necessary to extend existing PGO training scripts, you could do the same if a standalone Xenforo specific code/functions php script was made which could be run from PHP command line. This would then be passed to compiler during PHP PGO training phase.

So any folks interested in helping to take Xenforo PHP 7+ performance to the next level ? :)
 
Last edited:
Top Bottom