]> git.lyx.org Git - lyx.git/commit
Remove a conversion to_utf8() inside FontSetChanger
authorGuillaume Munch <gm@lyx.org>
Tue, 7 Jun 2016 21:58:55 +0000 (22:58 +0100)
committerGuillaume Munch <gm@lyx.org>
Mon, 13 Jun 2016 07:46:15 +0000 (08:46 +0100)
commitb2b8733096543b80b918375cc8a0e1fa6c5fd8b8
treefe78fc7d3509afe5827c3f8234aeb4c63f64cfb0
parent325c476bcb5103c72a7bc6fbc01658c14db304c4
Remove a conversion to_utf8() inside FontSetChanger

This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).

Profiling of scrolling inside a document over macro-instensive areas:

Before the patch:
  44,1% BufferView::updateMetrics()
   -> 34,8% InsetMathHull::metrics()
     -> 9,8% FontSetChanger::FontSetChanger()
  28,4% BufferView::draw()

After the patch:
  35,3% BufferView::updateMetrics()
   -> 27,2% InsetMathHull::metrics
     -> 0,4% FontSetChanger::FontSetChanger()
  47,5% BufferView::draw()

FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.
18 files changed:
src/MetricsInfo.cpp
src/MetricsInfo.h
src/mathed/InsetMathBrace.cpp
src/mathed/InsetMathDecoration.cpp
src/mathed/InsetMathEnsureMath.cpp
src/mathed/InsetMathFont.cpp
src/mathed/InsetMathFont.h
src/mathed/InsetMathFontOld.cpp
src/mathed/InsetMathFontOld.h
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathHull.h
src/mathed/InsetMathSymbol.cpp
src/mathed/MathData.cpp
src/mathed/MathFactory.cpp
src/mathed/MathMacro.cpp
src/mathed/MathMacroTemplate.cpp
src/mathed/MathSupport.cpp
src/mathed/MathSupport.h