79575[BUGFIX] Consider more TMENU a-tag related config for runtime cache
Commit message
Review
-
Code review CR +2 Done
- Nikita Hovratov +2
- Garvin Hicking +1
- Stefan Bürk +1
- Benni Mack +1
-
Verified V +2 Done
- Nikita Hovratov +2
- Garvin Hicking +1
- Stefan Bürk +1
- Benni Mack +1
- core-ci +1 CI
Issues 2
Files 1
Review log 2127
Show 12 earlier messages
-
Nikita Hovratov uploaded patch set 1 06/30/23, 21:13
-
core-ci voted on patch set 1 V -1 06/30/23, 21:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43168
-
Nikita Hovratov uploaded patch set 2
V -106/30/23, 21:29 -
Nikita Hovratov uploaded patch set 3 06/30/23, 21:38
-
core-ci voted on patch set 2 V -1 06/30/23, 21:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43169
-
core-ci voted on patch set 3 V +1 06/30/23, 21:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43170
-
Benni Mack commented on patch set 3 07/02/23, 18:54
-
Benni Mack commented on patch set 3 07/02/23, 18:55
I think we should proceed how it is now, and consider a cache at the LinkBuilder level, instead of this HMENU speciality. -
Nikita Hovratov uploaded patch set 4
V +107/03/23, 08:59 -
Nikita Hovratov commented on patch set 4 07/03/23, 09:00
AbstractMenuContentObject.php:1202ReplyDone -
Nikita Hovratov commented on patch set 4 07/03/23, 09:00
Reply
Yes, that's what I have thought as well. -
core-ci voted on patch set 4 V +1 07/03/23, 09:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43204
-
Benni Mack voted on patch set 4 V +1 CR +1 07/03/23, 09:58
-
Garvin Hicking commented on patch set 4 07/03/23, 12:17
Thank you! Works for us, please see inline comment about maybe using serialize(), and only using it if necessary?AbstractMenuContentObject.php:1206May I suggest two changes to this; one being to use serialize() instead of json_encode() (should be roughly 50% faster), the other not calling those methods if an empty array is used. That would result in this code: $cacheId = 'menu-generated-links-' . md5( $key . ($altTarget ?: ($this->mconf['target'] ?? '') . (isset($this->mconf['target.']) ? serialize($this->mconf['target.']) : '')) . $typeOverride . $MP_var . ($this->mconf['addParams'] ?? '') . ($this->I['val']['additionalParams'] ?? '') . ((string)($this->mconf['showAccessRestrictedPages'] ?? '_')) . (isset($this->mconf['showAccessRestrictedPages.']) ? serialize($this->mconf['showAccessRestrictedPages.']) : '') . serialize($this->menuArr[$key]) . ($this->I['val']['ATagParams'] ?? '') . (isset($this->I['val']['ATagParams.']) ? serialize($this->I['val']['ATagParams.']) : '') ); -
Nikita Hovratov commented on patch set 4 07/03/23, 12:41
AbstractMenuContentObject.php:1206ReplyI'm ok with adding conditions to prevent unnecessary functional calls, but I'm not sure with using serialize. This was changed before to json_encode from serialize because of some reasons I'm not aware of. Maybe @benni knows it? -
Nikita Hovratov uploaded patch set 5
CR +1V +107/03/23, 12:51 -
Nikita Hovratov uploaded patch set 6 07/03/23, 12:52
-
core-ci voted on patch set 6 V +1 07/03/23, 13:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43229
-
core-ci voted on patch set 5 V -1 07/03/23, 13:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43228
-
Stefan Bürk commented on patch set 6 07/03/23, 13:18
AbstractMenuContentObject.php:1206Reply> (should be roughly 50% faster) Do you have some benchmarks or resources baking this statement? I remember that Larry had done benchmarks, and I read quite some also which says bascially the opossit. For a pure encoding the json_encode() is faster, specially with raising data sizes. As we do not need a revert (decode). If decode would be an option it would be another point. That have changed over time, in earlier php versions the serialize() have been faster on a pure serialize()/encode() comparision, Sadly, I have the bookmark not with me atm. What I could found on a quick research: * https://medium.com/@moinuddinchowdhury/serialize-vs-json-67fe872a7755 * https://stackoverflow.com/questions/804045/preferred-method-to-store-php-arrays-json-encode-vs-serialize Other point would be to rething replacing `md5()` with `hash('xxh3', ...)` as this has is quicker on that level. (Not sure because of backport). -
Garvin Hicking commented on patch set 6 07/03/23, 15:46
AbstractMenuContentObject.php:1206ReplyHi Stefan, hehe. Never trust stackoverflow, I learned (again...). Actually I used the same stackoverflow post and saw multiple people report PHP8 having faster serialize(), i.e. https://stackoverflow.com/questions/804045/preferred-method-to-store-php-arrays-json-encode-vs-serialize#comment119151993_804089. Running that code on 3v4l.org with PHP 8.2.7 actually shows it performs roughly the same with a margin of 1% of difference. Then I tried a benchmark of 1k calls of json_encode vs. serialize on this actual patch and got similar results. Both json_encode and serialize take around 0.029 seconds for 1.000 calls. So I'm sorry for that part of the excursion, so yeah, just keep json_encode for the sake of earlier reasoning. However - trying to only do that serializing if an actual data input is there, and not call it with an empty array argument, that should save a few op calls, especially when many links may be generated on cache warmup. Thanks, Garvin -
Nikita Hovratov commented on patch set 6 07/03/23, 16:42
AbstractMenuContentObject.php:1206ReplyThanks! Do you want to vote then? Together with Bennis vote we could merge it right away. -
Stefan Bürk voted on patch set 6 V +1 CR +1 07/03/23, 19:26
-
Benni Mack voted on patch set 6 V +1 CR +1 07/03/23, 19:54
-
Garvin Hicking voted on patch set 6 V +1 CR +1 07/03/23, 20:04
-
Nikita Hovratov voted on patch set 6 V +2 CR +2 07/04/23, 07:17
-
Nikita Hovratov merged patch set 7 07/04/23, 07:31
AbstractMenuContentObject.php:1202