Bug 362946 - keyboard kcm build too fat
Summary: keyboard kcm build too fat
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keyboard (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Andriy Rysin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-11 14:52 UTC by Harald Sitter
Modified: 2019-11-29 07:53 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Sitter 2016-05-11 14:52:28 UTC
Building the keyboard kcm takes anywhere between 20 and 40% of the overall plasma-desktop build time. It also consumes obscene amounts of memory in the process, opening the build up to fail from OOM if too much other stuff is going on (chrome, other build, -jN) as memory exhaustion is a real possibility.

This makes all of plasma-desktop CI take forever and ultimately obnoxiously un-CIable as everything takes twice as long as it technically needed to.

Of a 50 minute plasma-desktop build about 10 to 20 minutes are spent *only* working on this one KCM. For comparision, building khtml with all bells and whistles takes between 20 and 30 minutes.

Build should be faster or the kcm should be split into a standalone repository so it doesn't impact plasma-desktop builds.

Reproducible: Always
Comment 1 Andriy Rysin 2016-05-11 16:34:05 UTC
I think the slow part is using boost library for keyboard geometry preview. It should be fairly easy to add a flag to skip geometry code.
Unfortunately it's been a while since I did active KDE development so I would not be able to help.
Comment 2 Nate Graham 2019-02-13 16:20:14 UTC
I used to be able to reproduce the OOM smasher, but I can't anymore. The level of recursion is still pretty bonkers though, and does indeed bloat the build time quite a bit.
Comment 3 Harald Sitter 2019-11-29 07:53:25 UTC
Git commit c7a1f606ca9669d3732786a4701bec8457cc8eeb by Harald Sitter.
Committed on 29/11/2019 at 07:53.
Pushed by sitter into branch 'master'.

replace bespoke xkb geometry parser with xkb

Summary:
the bespoke parser was a horrendous drain on the build time of
plasma-desktop due to recursive templates.
it's been replaced with a new standalone binary that previews any
model/layout/variant/options combination as requested and a qtquick UI
which simplifies the actual rendering substantially.

the new code is better in that it:
- builds in a fraction of the time with a fraction of the power use
- renders complex models (such as the tm2020 or the kinesis) correctly
- because it entirely relies on xkb to figure out keysyms belonging to
  a given key, it's layout representation is not only substantially more
  complete it also correctly obeys options like eurosign:2
- renders numlock and the like (not that this is in fact very useful ^^)
- is following the system palette for coloring
- the paint code should be easier to graps and more robust because xkb
  provides completely consistent geometry and layout data meaning we can
  model this verbatim in qtquick and then scale the entire
  keyboard to a useful size
- this is now a standalone application so potential input method KCMs
  can opt to use it (e.g. fcitx)

Test Plan: preview all the layouts and all the models

Reviewers: #plasma

Subscribers: davidre, ngraham, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D25191

M  +5    -34   kcms/keyboard/CMakeLists.txt
M  +0    -2    kcms/keyboard/config-keyboard.h.cmake
M  +8    -18   kcms/keyboard/kcm_add_layout_dialog.cpp
M  +5    -6    kcms/keyboard/kcm_add_layout_dialog.h
M  +19   -24   kcms/keyboard/kcm_keyboard_widget.cpp
M  +0    -2    kcms/keyboard/kcm_keyboard_widget.h
D  +0    -7    kcms/keyboard/preview/TODO
D  +0    -245  kcms/keyboard/preview/geometry_components.cpp
D  +0    -362  kcms/keyboard/preview/geometry_components.h
D  +0    -593  kcms/keyboard/preview/geometry_parser.cpp
D  +0    -161  kcms/keyboard/preview/geometry_parser.h
D  +0    -375  kcms/keyboard/preview/kbpreviewframe.cpp
D  +0    -95   kcms/keyboard/preview/kbpreviewframe.h
D  +0    -128  kcms/keyboard/preview/keyaliases.cpp
D  +0    -36   kcms/keyboard/preview/keyaliases.h
D  +0    -133  kcms/keyboard/preview/keyboardlayout.cpp
D  +0    -115  kcms/keyboard/preview/keyboardlayout.h
D  +0    -100  kcms/keyboard/preview/keyboardpainter.cpp
D  +0    -51   kcms/keyboard/preview/keyboardpainter.h
D  +0    -901  kcms/keyboard/preview/keysym2ucs.cpp
D  +0    -27   kcms/keyboard/preview/keysym2ucs.h
D  +0    -59   kcms/keyboard/preview/keysymbols.cpp
D  +0    -36   kcms/keyboard/preview/keysymbols.h
D  +0    -83   kcms/keyboard/preview/keysymhelper.cpp
D  +0    -41   kcms/keyboard/preview/keysymhelper.h
D  +0    -288  kcms/keyboard/preview/symbol_parser.cpp
D  +0    -93   kcms/keyboard/preview/symbol_parser.h
A  +66   -0    kcms/keyboard/tastenbrett.cpp     [License: GPL (v2/3)]
A  +35   -0    kcms/keyboard/tastenbrett.h     [License: GPL (v2/3)]
A  +34   -0    kcms/keyboard/tastenbrett/CMakeLists.txt
A  +8    -0    kcms/keyboard/tastenbrett/README.md
A  +36   -0    kcms/keyboard/tastenbrett/application.cpp     [License: GPL (v2/3)]
A  +43   -0    kcms/keyboard/tastenbrett/application.h     [License: GPL (v2/3)]
A  +93   -0    kcms/keyboard/tastenbrett/doodad.cpp     [License: GPL (v2/3)]
A  +156  -0    kcms/keyboard/tastenbrett/doodad.h     [License: GPL (v2/3)]
A  +45   -0    kcms/keyboard/tastenbrett/geometry.cpp     [License: GPL (v2/3)]
A  +45   -0    kcms/keyboard/tastenbrett/geometry.h     [License: GPL (v2/3)]
A  +257  -0    kcms/keyboard/tastenbrett/key.cpp     [License: GPL (v2/3)]
A  +94   -0    kcms/keyboard/tastenbrett/key.h     [License: GPL (v2/3)]
A  +151  -0    kcms/keyboard/tastenbrett/main.cpp     [License: GPL (v2/3)]
A  +34   -0    kcms/keyboard/tastenbrett/outline.cpp     [License: GPL (v2/3)]
A  +46   -0    kcms/keyboard/tastenbrett/outline.h     [License: GPL (v2/3)]
A  +12   -0    kcms/keyboard/tastenbrett/qml.qrc
A  +26   -0    kcms/keyboard/tastenbrett/qml/IndicatorDoodad.qml     [License: GPL (v2/3)]
A  +85   -0    kcms/keyboard/tastenbrett/qml/Key.qml     [License: GPL (v2/3)]
A  +63   -0    kcms/keyboard/tastenbrett/qml/KeyCap.qml     [License: GPL (v2/3)]
A  +31   -0    kcms/keyboard/tastenbrett/qml/KeyCapLabel.qml     [License: GPL (v2/3)]
A  +110  -0    kcms/keyboard/tastenbrett/qml/ShapeCanvas.qml     [License: GPL (v2/3)]
A  +39   -0    kcms/keyboard/tastenbrett/qml/ShapeDoodad.qml     [License: GPL (v2/3)]
A  +41   -0    kcms/keyboard/tastenbrett/qml/TextDoodad.qml     [License: GPL (v2/3)]
A  +207  -0    kcms/keyboard/tastenbrett/qml/main.qml     [License: GPL (v2/3)]
A  +35   -0    kcms/keyboard/tastenbrett/row.cpp     [License: GPL (v2/3)]
A  +53   -0    kcms/keyboard/tastenbrett/row.h     [License: GPL (v2/3)]
A  +52   -0    kcms/keyboard/tastenbrett/section.cpp     [License: GPL (v2/3)]
A  +53   -0    kcms/keyboard/tastenbrett/section.h     [License: GPL (v2/3)]
A  +46   -0    kcms/keyboard/tastenbrett/shape.cpp     [License: GPL (v2/3)]
A  +42   -0    kcms/keyboard/tastenbrett/shape.h     [License: GPL (v2/3)]
A  +28   -0    kcms/keyboard/tastenbrett/xkbobject.cpp     [License: GPL (v2/3)]
A  +52   -0    kcms/keyboard/tastenbrett/xkbobject.h     [License: GPL (v2/3)]
M  +0    -33   kcms/keyboard/tests/CMakeLists.txt
D  +0    -101  kcms/keyboard/tests/geometry_parser_test.cpp
M  +0    -83   kcms/keyboard/xkb_rules.cpp
M  +0    -24   kcms/keyboard/xkb_rules.h

https://commits.kde.org/plasma-desktop/c7a1f606ca9669d3732786a4701bec8457cc8eeb