Skip to content

To build with PIC/PIE enabled for all objects or not #35

Open
@petk

Description

@petk

Currently this build system builds all objects with PIC and PIE compile-time and link-time options, which brings performance overhead. This is done because it is very difficult to build shared SAPIs (embed, apache2handler, phpdbg) at the same time as other SAPIs. But it probably should be reconsidered/rechecked/refactored differently because performance difference outweighs the build system difficulties. At least according to some initial benchmarks done.

Autotools build system also always builds all objects as PIC but libtool adds very "optimized" (read, limited) options. There are also some performance differences between Autotools and CMake build systems at the moment in some cases.

Performance

There is performance overhead by enabling PIC for targets that don't require it.

  • Build type: Release (-O3)
  • CMake-based build system

PHP 8.3

  • Zend/bench.php:

    Without PIC With PIC
    0.293 0.315
    0.295 0.311
    0.291 0.310
    0.288 0.314
  • Zend/micro_bench.php

    Without PIC With PIC
    1.493 1.578
    1.491 1.574
    1.494 1.601
    1.487 1.554

PHP 8.4

  • Zend/bench.php:

    Without PIC With PIC
    0.308 0.320
    0.307 0.320
    0.304 0.321
    0.308 0.323
    0.307 0.316
  • Zend/micro_bench.php

    Without PIC With PIC
    1.430 1.476
    1.439 1.478
    1.440 1.471
    1.451 1.507

PHP 8.5

  • Zend/bench.php

    Without PIC With PIC
    0.310 0.308
    0.309 0.310
    0.311 0.307
    0.311 0.309
    0.309 0.312
    0.312 0.306
    0.307 0.304
  • Zend/micro_bench.php

    Without PIC With PIC
    1.414 1.452
    1.398 1.440
    1.403 1.469
    1.422 1.481
    1.406 1.435

TODO: Recheck whether building shared SAPIs should be done differently, and retest for performance differences.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions