Cleaned up and optimized wfBaseConvert();
authorTyler Anthony Romeo <tylerromeo@gmail.com>
Tue, 25 Dec 2012 20:32:04 +0000 (15:32 -0500)
committerTyler Anthony Romeo <tylerromeo@gmail.com>
Thu, 27 Dec 2012 05:17:18 +0000 (00:17 -0500)
commit9b9daadc46b3456dd9b9120e4aeb98e2ae38f26a
tree8ab0da2c24e4dc00cb5ea2478a95e0f6158e23e7
parentae268cdc3845aa369fd3994aa6dc045edc75a571
Cleaned up and optimized wfBaseConvert();

* Added code to use BCMath or GMP if they are
  loaded, since they are both significantly faster.
  A parameter was added that can be used to force
  usage of a specific engine (mainly for testing).
* Made an array of base digits rather than using
  strpos() every time.
* Used casting instead of intval(), since the latter
  is six times slower.

Also added unit tests for wfBaseConvert as well as
a benchmarking class that measures the difference
between using GMP, BCMath, and pure PHP.

Change-Id: I841717be2b29a0b7fc57a13fde5cc0642cda82df
includes/GlobalFunctions.php
maintenance/benchmarks/bench_wfBaseConvert.php [new file with mode: 0644]
tests/phpunit/includes/GlobalFunctions/wfBaseConvertTest.php [new file with mode: 0644]