aboutsummaryrefslogtreecommitdiffstats
path: root/includes/libs/StaticArrayWriter.php
Commit message (Collapse)AuthorAgeFilesLines
* StaticArrayWriter: Optimize expensive logic for speedthiemowmde2025-01-221-53/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This little library is used by our LocalisationCache (LC). The output is heavily cached and this code ends being called very rarely. But when it is called it's surprisingly expensive. This is relevant especially in test scenarios where caches are not primed or intentionally purged. With this patch the relative time spend in this class alone goes down from 24% to 15%, according to XDebug. The total time spend in LocalisationCache goes down from 37% to 28%. I find this a surprisingly big difference considering the code still executes the same deeply nested loops as before. Reasons are: * str_repeat is entirely gone. * Single-use methods are inlined, avoiding PHP's expensive call stack overhead. * Instead of checking if var_dump returns the string "NULL" we check the original value. The tests prove that this patch doesn't cause any visible change. To test this locally you can add this to your LocalSettings: $wgLocalisationCacheConf['forceRecache'] = true; Bug: T381895 Change-Id: I3befa7f0215980d423840a65bf9e79b4b3c5bb1c
* StaticArrayWriter: Output lists as lists, not as assoc arraysBartosz DziewoƄski2024-02-151-19/+40
| | | | | | | The unnecessary numeric keys for arrays which are lists in config-schema.php have been really bugging me. Change-Id: I09eade2a8c6b158a90f1b8259be4a7bc6e7cb086
* Generate DefaultSettings.php from schemadaniel2022-03-181-9/+26
| | | | | | Avoid having to maintain defaults twice. Change-Id: I7a883fe3c952cc653d43b7e399631ec3beab0bc3
* Add pre-generator for config-schema.phpPetr Pchelko2022-02-031-1/+7
| | | | | Bug: T300129 Change-Id: Ib2620993114af5a659bda60dc45b6fb3bed657b0
* language: Autoload normalize data and remove transformUsingPairFile compatTimo Tijhof2021-08-101-0/+28
| | | | | | | | | | | | | | | | | | | | * Turn normalize data into an autoloadable class and use the class name as key instead of a partial file name with a base directory. * This protected function is not aimed at re-use in extensions, has no other usage known to Codesearch. Mark it internal, and remove the compat introduced by 31283f34bf0. * Update the now ten-year-old documentation comments that described this as "Temporary". The functionality and comment were introduced in 2010 by Tim with r60599 (ad19c032b0f). Ref <https://bash.toolforge.org/search?p=0&q=temporary>. * Replace the broken wikitech-l archive link with a working one, and describe the thread for easier future reference. Bug: T225756 Change-Id: I004da1f25c19e1095d0917349f2ba8461f9f0715
* Annotate newable classesdaniel2020-07-071-0/+1
| | | | | | | | This annotates classes that can safely be instantiated by extensions, per the Stable Interface Policy. Bug: T247862 Change-Id: Ia280f559874fc0750265ddeb7f831e65fd7d7d6a
* StaticArrayWriter: Add a public static write() methodTimo Tijhof2020-06-161-12/+17
| | | | | | | | | | | | This is a simple utility. I would be worried if this nears the kind of complexity that warrants constructor parameters and state. Allow it to be used without instantiation for simpler use. Follows-up I022c074e8a708fb (3b1e8a5cef1be91). Change-Id: I044f423c5219d72bc76bb35ecbba906df0305e49
* Support nested arrays in StaticArrayWriterKunal Mehta2018-08-271-7/+30
| | | | | | | This is needed by LCStoreStaticArray. Bug: T200626 Change-Id: I76abd3849381b3b98e350a4627f3515eeb00fa2d
* Move wfMakeStaticArrayFile() into a classKunal Mehta2018-08-171-0/+49
And include tests :) This code is independent of MediaWiki, but not really large enough to be worth librarizing right now. Bug: T200626 Change-Id: I022c074e8a708fb5219bc4ff4b53e7e31f60dc4b