It appears like these methods are called hundreds of thousands of
times. This is mostly because they are recursive. According to my
benchmarks the changes proposed in this patch make a big difference.
Some notes:
* I try to avoid stepping deeper into the recursion whenever possible,
i.e. do the recursion only when the current element is an array.
This is relevant because the function call overhead is surpsiringly
expensive in PHP.
* I tried to arrange the if-elseif-else branches in a way so that the
most minimal code is executed while the code is still readable.
Change-Id: Ie8d8106390cac441cb93adcd48a937ba312a2d91
Some notes:
* Note that array_column() strips array keys. I checked and this is
fine here.
* Html::element() will skip attributes that are set to null or false.
Perfect fit here.
* I routinely remove comments that do notjing but repeat what the
code already says.
Change-Id: Ie7797b78f1af5d8404c9e97b333fac8c6b3ac85e
Note: I'm not sure if this code is copied from somewhere else. If it
is this change is better done in the source.
Change-Id: Ic84be9b8b52a190eb5a41f2c7ff8fd6c04724318
Personally I find them confusing because there is apparently no way
to "stop" an array_walk(), and that's why it constantly needs to
check if it even needs to run. Why not use a syntax we can actually
stop? I find this more readable and it makes the code actually run
faster. On average 50% of the iterations get skipped now.
Change-Id: I47b6d5b8f4ad5c9d0f47b389c638196e734809bb
We can now serve the JSON data almost directly (although, curiously,
we need a main file in the module that is JavaScript, not JSON),
and without using global state in the JS code.
Change-Id: I203b3e396b28f4b4ef49c3c0918a4025082308c4
Removes functionality to
* select PNG rendering mode
* automated fallback to PNG images for SVG rendering
* PNG mode related class and tests
However, PNG images received from mathoid / restbase are still stored.
Bug: T311620
Change-Id: I595926027433182cc0396570bc3f1ce0cd2cafb3
Needed for I869af06896b9757af18488b916211c5a41a8c563, where I am
trying to change LanguageFactory in MediaWiki core not to use
MWException.
I truly feel mocked after working with this code. See if you can find
the two lines in this diff where the meaningful changes are.
Change-Id: Ifcb31dbb7113ce57526f06558cde2abedee317d7
TexUtil gets instanciated and loads a json for each node in Literal and Fun1. This is not necessary since it takes much RAM and time to load the corresponding JSON from files.
Bug: T321599
Change-Id: I91855ebc4437f075302ae13d367ca4902cc0f3ba
These tests are skipped in CI, but are ran locally.
Contains also preliminary fixes to make the assertions not crash
locally and a shellscript for downloading the json-file with tests locally.
Bug: T315223
Change-Id: If5da7e2a29d9179eabecbb4707ed244f5d445d39
For development history of this changeset see:
Id96a4b1b55e3959aab81f4ba436c5ac125f2a1bb
Bug: T312528
Change-Id: I61cfdbd63f8d50b072ada05927a134686fdd53d3