Bug 28278: Improve $KOHA_CONF parsing speed by using XML::LibXML
authorJulian Maurice <julian.maurice@biblibre.com>
Fri, 30 Apr 2021 15:13:48 +0000 (17:13 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 7 May 2021 12:44:00 +0000 (14:44 +0200)
commita892f655efae77b302c9cd5978d4881eac14589c
treeb249133721b8741e6ce438c892b68ef4074faf8c
parent9d19e85d04f8d26deba37533b0a1d516dd42d78f
Bug 28278: Improve $KOHA_CONF parsing speed by using XML::LibXML

- Without the patch:

$ hyperfine --warmup 1 \
  'perl -MKoha::Config -e "Koha::Config->read_from_file(\$ENV{KOHA_CONF}) for (1..1000)"'

  Time (mean ± σ):      3.585 s ±  0.018 s    [User: 3.531 s, System: 0.049 s]
  Range (min … max):    3.547 s …  3.612 s    10 runs

- With the patch:

$ hyperfine --warmup 1 \
  'perl -MKoha::Config -e "Koha::Config->read_from_file(\$ENV{KOHA_CONF}) for (1..1000)"'

  Time (mean ± σ):      1.122 s ±  0.028 s    [User: 1.104 s, System: 0.014 s]
  Range (min … max):    1.095 s …  1.189 s    10 runs

Test plan:
1. Apply the first patch (the one with the unit tests) and make sure
   tests pass: `prove t/Koha/Config.t`
2. Apply the rest of the patches and verify that tests still pass:
   `prove t/Koha/Config.t`.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Config.pm