Review main Merged

62740[TASK] Move TYPO3_version constant to a dedicated class

Benni Mack CR +2 V +2 Hard +218 −153 updated 01/09/20, 09:46

Commit message

To optimize TYPO3 for Opcaching and speeding up performance,
as well as simplyfing the bootstrap (also for the testing framework)
the constants
* TYPO3_version
* TYPO3_branch
are moved to a new PHP class "Typo3Version".

This reduces the necessity to define the constants, and since
TYPO3 Bootstrap continues to use the class, the constants
are defined in the constructor for TYPO3 v10, and will be removed
in TYPO3 v11.

Review

  • Code review CR +2 Done
    • Oliver Hader +2
    • Georg Ringer +1
    • Tymoteusz Motylewski +1
  • Verified V +2 Done
    • Oliver Hader +2
    • Georg Ringer +1
    • TYPO3com +1 CI

Issues 1

Files 32

Show 12 more files

Review log 1927

Show 12 earlier messages
  1. Benni Mack uploaded patch set 1 12/18/19, 12:51

  2. TYPO3com voted on patch set 1 V +1 12/18/19, 12:59 Completed build in 07m 58s on Wed, 18 Dec, 12:59 PM Test Summary: 69246 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-39503

  1. Benni Mack updated the commit message in patch set 2 12/23/19, 22:25

  2. Benni Mack uploaded patch set 3 12/23/19, 22:31

  3. TYPO3com voted on patch set 2 V -1 12/23/19, 22:38 Completed build in 12m 15s on Mon, 23 Dec, 10:38 PM Test Summary: 525 of 69578 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-39562

  4. TYPO3com voted on patch set 3 V -1 12/23/19, 22:41 Completed build in 09m 20s on Mon, 23 Dec, 10:40 PM Test Summary: 28 of 69578 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-39563

  5. TYPO3com voted on patch set 3 V +1 12/24/19, 08:18 Completed build in 9h 56m 21s on Tue, 24 Dec, 08:18 AM Test Summary: 69128 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-39563

  6. Anja Leichsenring commented on patch set 4 12/27/19, 16:15

    Published edit on patch set 3.
  7. TYPO3com voted on patch set 4 V +1 12/27/19, 16:23 Completed build in 07m 51s on Fri, 27 Dec, 04:23 PM Test Summary: 69128 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-39603

  8. Oliver Klee commented on patch set 4 12/27/19, 17:16

    AboutController.php:78 Unresolved

    Are you intentionally omitting the pair of parenthesis after the class name?
  9. Georg Ringer commented on patch set 4 12/27/19, 19:37

    BackendController.php:223 Unresolved

    should we move that one line up to a new variable?

    Typo3Version.php:20 Unresolved

    why is this public? this means there are 2 ways to access it, either use it directly or the getter. I would like to have only 1 way
  10. Benni Mack uploaded patch set 5 12/27/19, 20:20

  11. Benni Mack commented on patch set 5 12/27/19, 20:22

    I fixed the issues mentioned by Oli and Georg. The new Typo3Version() is now used when e.g. cache identifiers are set up, otherwise GeneralUtility::makeInstance().
  12. TYPO3com voted on patch set 5 V -1 12/27/19, 20:42 Completed build in 16m 43s on Fri, 27 Dec, 08:42 PM Test Summary: 66 of 69578 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-39608

  13. Benni Mack uploaded patch set 6 12/27/19, 21:29

  14. TYPO3com voted on patch set 6 V +1 12/27/19, 22:21 Completed build in 51m 19s on Fri, 27 Dec, 10:21 PM Test Summary: 69110 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-39624

  15. Oliver Hader commented on patch set 6 12/31/19, 12:20

    Typo3Version.php:20 Unresolved

    This is something we need to adjust in packaging script...

    Typo3Version.php:36 Unresolved

    Should we add an additional __toString() method here?
  16. Benni Mack uploaded patch set 7 12/31/19, 13:02

  17. TYPO3com voted on patch set 7 V +1 12/31/19, 13:11 Completed build in 09m 12s on Tue, 31 Dec, 01:11 PM Test Summary: 69116 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-39680

  18. Tymoteusz Motylewski commented on patch set 7 01/03/20, 22:06

    2c - can you shed some light how this change helps with opcache? - can't we make this class method static, so you don't have to create object all the time
  19. Benni Mack commented on patch set 7 01/06/20, 08:29

    > Patch Set 7: > > 2c > - can you shed some light how this change helps with opcache? a) opcache does not cache "runtime" changes of course, such as $a = $b; it can pre-compile the code, but not the values. b) although the topic is not widely covered in blog posts or official docs (mostly in presentations on PHP conferences), you can do "fun" tests with https://www.php.net/manual/en/function.opcache-get-status.php to see what gets cached and what does not. c) the main thing with the define() is that it's in "global" state which cannot be opcached in namespaces classes (see this RFC for PHP 8.0) https://wiki.php.net/rfc/use_global_elements > - can't we make this class method static, so you don't have to create object all the time Yup. If we make it static (or basically allow people to add the static public properties), then we benefit from Opcache as well. But we cannot use this class in tests for dependency injection unfortunately. This is one of the main reasons I really dislike our "Utility" classes. Since PHP7, doing either static public class constants or methods as it is now, is not really relevant performance-wise anymore, since the method is only used a handful of times in TYPO3 Core during one PHP process and code has been byte-code converted already.
  20. Tymoteusz Motylewski commented on patch set 7 CR +1 01/06/20, 22:24

    > Patch Set 7: > > > Patch Set 7: > > > > 2c > > - can you shed some light how this change helps with opcache? > a) opcache does not cache "runtime" changes of course, such as $a = $b; it can pre-compile the code, but not the values. > b) although the topic is not widely covered in blog posts or official docs (mostly in presentations on PHP conferences), you can do "fun" tests with https://www.php.net/manual/en/function.opcache-get-status.php to see what gets cached and what does not. > c) the main thing with the define() is that it's in "global" state which cannot be opcached in namespaces classes (see this RFC for PHP 8.0) https://wiki.php.net/rfc/use_global_elements > > > > - can't we make this class method static, so you don't have to create object all the time > Yup. If we make it static (or basically allow people to add the static public properties), then we benefit from Opcache as well. But we cannot use this class in tests for dependency injection unfortunately. This is one of the main reasons I really dislike our "Utility" classes. Since PHP7, doing either static public class constants or methods as it is now, is not really relevant performance-wise anymore, since the method is only used a handful of times in TYPO3 Core during one PHP process and code has been byte-code converted already. Thanks a lot for explanation!
  21. Georg Ringer voted on patch set 7 V +1 CR +1 01/08/20, 11:17

  22. Oliver Hader voted on patch set 7 CR +1 01/09/20, 09:32

  23. Oliver Hader voted on patch set 7 V +2 CR +2 01/09/20, 09:45

  24. Oliver Hader merged patch set 8 01/09/20, 09:45

  25. Oliver Hader commented on patch set 8 01/09/20, 09:46

    → change to release script "darth" at https://github.com/TYPO3/darth/pull/12