Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php is slower with lto build workaround #109

Closed
justanerd opened this issue Apr 27, 2018 · 4 comments
Closed

php is slower with lto build workaround #109

justanerd opened this issue Apr 27, 2018 · 4 comments

Comments

@justanerd
Copy link

justanerd commented Apr 27, 2018

gcc version 7.3.0 (Gentoo 7.3.0 p1.0)

I've been playing around with my build flags.
I noticed a regression when --disable-gcc-global-regs is enabled.
Building php without LTO and without --disable-gcc-global-regs results in faster php here are the php bench results:

with lto and workaround

                   test_arithmetic         0.0012 seconds.
              test_array_operators         0.0007 seconds.
                      test_bitwise         0.0007 seconds.
                      test_casting         0.1642 seconds.
                    test_chr_fixed         0.0473 seconds.
                test_chr_hardcoded         0.0470 seconds.
                      test_chr_var         0.0830 seconds.
                 test_comment_loop         0.0206 seconds.
                      test_compare         0.0007 seconds.
                test_compare_false         0.0007 seconds.
               test_compare_invert         0.0008 seconds.
               test_compare_strict         0.0007 seconds.
             test_compare_unstrict         0.0008 seconds.
                    test_constants         0.0080 seconds.
                        test_crc32         0.0052 seconds.
                     test_do_while         0.0642 seconds.
               test_do_while_break         0.0069 seconds.
                        test_empty         0.0007 seconds.
                   test_empty_loop         0.0207 seconds.
                         test_ereg         0.0148 seconds.
                      test_foreach         0.0996 seconds.
                    test_get_class         0.0046 seconds.
         test_global_scalar_assign         0.0135 seconds.
         test_global_string_assign         0.0303 seconds.
                  test_if_constant         0.0007 seconds.
                    test_increment         0.0041 seconds.
                     test_is_array         0.0008 seconds.
                    test_is_object         0.0007 seconds.
                      test_is_type         0.0007 seconds.
                        test_isset         0.0007 seconds.
                         test_line         0.0007 seconds.
           test_local_array_assign         0.0020 seconds.
         test_local_boolean_assign         0.0007 seconds.
           test_local_float_assign         0.0007 seconds.
            test_local_hash_assign         0.0057 seconds.
         test_local_integer_assign         0.0008 seconds.
          test_local_object_assign         0.0069 seconds.
          test_local_scalar_assign         0.0008 seconds.
          test_local_string_assign         0.0007 seconds.
                          test_md5         0.0189 seconds.
                    test_microtime         0.0493 seconds.
                      test_mt_rand         0.0038 seconds.
                          test_ord         0.1215 seconds.
            test_ordered_functions         0.1278 seconds.
 test_ordered_functions_references         0.1844 seconds.
                   test_preg_match         0.0118 seconds.
                         test_rand         0.0038 seconds.
                   test_references         0.0024 seconds.
                         test_sha1         0.0220 seconds.
                test_string_append         0.0007 seconds.
                       test_strlen         0.0007 seconds.
                       test_switch         0.0382 seconds.
                         test_time         0.0031 seconds.
          test_unordered_functions         0.1268 seconds.
           test_variable_variables         0.0080 seconds.
                        test_while         0.0645 seconds.

System     : Linux deepspace 4.16.0-jk1 #1 SMP PREEMPT Fri Apr 27 12:43:08 CEST 2018 x86_64
PHP version: 7.2.5
PHPBench   : 0.8.1
Date       : April 27, 2018, 7:12 pm
Tests      : 56
Iterations : 100000
Total time : 1 seconds
Score      : 688687 (higher is better)

without lto and workaround


                   test_arithmetic         0.0009 seconds.
              test_array_operators         0.0006 seconds.
                      test_bitwise         0.0006 seconds.
                      test_casting         0.1619 seconds.
                    test_chr_fixed         0.0418 seconds.
                test_chr_hardcoded         0.0405 seconds.
                      test_chr_var         0.0685 seconds.
                 test_comment_loop         0.0173 seconds.
                      test_compare         0.0006 seconds.
                test_compare_false         0.0006 seconds.
               test_compare_invert         0.0006 seconds.
               test_compare_strict         0.0006 seconds.
             test_compare_unstrict         0.0006 seconds.
                    test_constants         0.0074 seconds.
                        test_crc32         0.0049 seconds.
                     test_do_while         0.0426 seconds.
               test_do_while_break         0.0058 seconds.
                        test_empty         0.0006 seconds.
                   test_empty_loop         0.0171 seconds.
                         test_ereg         0.0144 seconds.
                      test_foreach         0.0592 seconds.
                    test_get_class         0.0040 seconds.
         test_global_scalar_assign         0.0133 seconds.
         test_global_string_assign         0.0284 seconds.
                  test_if_constant         0.0006 seconds.
                    test_increment         0.0034 seconds.
                     test_is_array         0.0006 seconds.
                    test_is_object         0.0006 seconds.
                      test_is_type         0.0006 seconds.
                        test_isset         0.0006 seconds.
                         test_line         0.0006 seconds.
           test_local_array_assign         0.0017 seconds.
         test_local_boolean_assign         0.0006 seconds.
           test_local_float_assign         0.0006 seconds.
            test_local_hash_assign         0.0050 seconds.
         test_local_integer_assign         0.0006 seconds.
          test_local_object_assign         0.0058 seconds.
          test_local_scalar_assign         0.0006 seconds.
          test_local_string_assign         0.0006 seconds.
                          test_md5         0.0190 seconds.
                    test_microtime         0.0494 seconds.
                      test_mt_rand         0.0033 seconds.
                          test_ord         0.0887 seconds.
            test_ordered_functions         0.0840 seconds.
 test_ordered_functions_references         0.1574 seconds.
                   test_preg_match         0.0109 seconds.
                         test_rand         0.0033 seconds.
                   test_references         0.0021 seconds.
                         test_sha1         0.0205 seconds.
                test_string_append         0.0006 seconds.
                       test_strlen         0.0006 seconds.
                       test_switch         0.0316 seconds.
                         test_time         0.0025 seconds.
          test_unordered_functions         0.0822 seconds.
           test_variable_variables         0.0065 seconds.
                        test_while         0.0420 seconds.

System     : Linux deepspace 4.16.0-jk1 #1 SMP PREEMPT Fri Apr 27 12:43:08 CEST 2018 x86_64
PHP version: 7.2.5
PHPBench   : 0.8.1
Date       : April 27, 2018, 7:16 pm
Tests      : 56
Iterations : 100000
Total time : 1 seconds
Score      : 862077 (higher is better)

@InBetweenNames
Copy link
Owner

Interesting! Is your non-LTO build -O3 ?

@justanerd
Copy link
Author

Both with -O3

@InBetweenNames
Copy link
Owner

It seems to me that the benefits of gcc-global-regs outweigh the benefits of LTO, according to these benchmarks. What do you think about leaving the PHP entry in ltoworkarounds.conf for documentation, but commented out?

@justanerd
Copy link
Author

Thats fine, I did the same thing locally for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants