Teacup_Firmware/configtool
Phil Hord 9d42fa4ac1 Configtool: speed up startup with wx-tricks.
This should fix issue #235.

Recently ConfigTool has been very slow for me on Ubuntu Linux.
When I run the app there is a 15 second wait before the window is
first displayed.  I bisected the problem and found it was tied to
the number of pins in `pinNames`, and ultimately that it was
caused by a slow initializer in wx.Choice() when the choices are
loaded when the widget is created.  For some reason, moving the
load after the widget is created is significantly faster.  This
change reduces my startup time to just under 4 seconds.

Further speedup could be had by using lazy initialization of the
controls.  But the controls are too bound up in the loaded data
to make this simple.  Maybe I will attack it later.

There is still a significant delay when closing the window, but I
haven't tracked what causes it.  Maybe it is caused just by
destroying all these pin controls.

In the process of making this change, I wanted to simplify the
number of locations that bothered to copy the pinNames list and,
to support lazy loading, to try to keep the same list in all
pinChoice controls.  I noticed that all the pinChoice controls
already have the same parameters passed to the addPinChoice
function which makes them redundant and confusing.  I removed the
extra initializers and just rely on pinNames as the only list
option in addPinChoice for now.  Maybe this flexibility is needed
for some reason later, but I can't see a purpose for it now.

Notes by reviewer Traumflug:

First of all, which "trick"? That's an excellent code
simplification and if this happens to make startup faster (it
does), all the better.

Measured startup & shutdown time here (click window close as soon
as it appears):

  Before:                With this commit:
  real    0m4.222s       real    0m3.780s
  user    0m3.864s       user    0m3.452s
  sys     0m0.084s       sys     0m0.100s

As the speedup was far more significant on the commit author's
machine, it might be a memory consumption issue (leading to
swapping on a small RAM machine). Linux allows to view this in
/proc/<pid>/status.

         Before:          Now:
VmPeak:	  708360 kB     708372 kB
VmSize:	  658916 kB     658756 kB
VmHWM:	   73792 kB      73492 kB
VmRSS:	   73792 kB      73492 kB
VmData:	  402492 kB     402332 kB

Still no obvious indicator, but a 300 kB smaller memory footprint
is certainly nice.
2016-10-26 22:00:21 +02:00
..
__init__.py Configtool: major restructuring. 2015-04-21 02:07:12 +02:00
accelerationpage.py Configtool: take advantage of the now recognized values. 2015-07-17 13:38:15 +02:00
addheaterdlg.py ARM, AVR: support inverted heater pin signals. 2015-08-13 17:12:10 +02:00
addsensordlg.py Added support for MCP3008 and MCP3004 ADC for temperature read 2016-04-12 22:37:50 +02:00
background.png Configtool: give the thing a nice background picture. 2015-05-30 18:41:02 +02:00
board.generic.h Configtool: also deal with PS_INVERT_ON. 2016-06-11 13:10:09 +02:00
board.py Configtool: write RX/TX_ENABLE_PIN as-is. 2016-06-06 14:38:07 +02:00
boardpanel.py Configtool: use platform.startswith() everywhere. 2016-06-11 12:41:10 +02:00
build.py Configtool: use platform.startswith() everywhere. 2016-06-11 12:41:10 +02:00
calcbelt.py Configtool: a few more apperance enhancements. 2015-04-21 02:51:30 +02:00
calcscrew.py Configtool: a few more apperance enhancements. 2015-04-21 02:51:30 +02:00
communicationspage.py Configtool: don't assign values to tuples. 2016-10-21 22:03:34 +02:00
cpupage.py Configtool: de-duplicate insertValues(). 2015-07-17 13:38:02 +02:00
data.py Configtool: use platform.startswith() everywhere. 2016-06-11 12:41:10 +02:00
decoration.py Configtool: color background matching the background picture. 2015-05-30 19:20:38 +02:00
displaypage.py Configtool: speed up startup with wx-tricks. 2016-10-26 22:00:21 +02:00
gui.py Configtool: make Settings the "global" container. 2016-06-05 21:09:11 +02:00
heaterlist.py ARM, AVR: support inverted heater pin signals. 2015-08-13 17:12:10 +02:00
heaterspage.py ARM, AVR: support inverted heater pin signals. 2015-08-13 17:12:10 +02:00
mechanicalpage.py Configtool: make KINEMATICS a set of booleans, too. 2016-04-20 22:02:07 +02:00
miscellaneouspage.py Temp: change TEMP_EWMA to integer. 2016-06-25 14:30:59 +02:00
page.py Configtool: speed up startup with wx-tricks. 2016-10-26 22:00:21 +02:00
pinoutspage.py Configtool: speed up startup with wx-tricks. 2016-10-26 22:00:21 +02:00
printer.generic.h Config files: update comment/help text for USE_INTERNAL_PULLUPS. 2016-09-30 13:51:01 +02:00
printer.py Configtool: add --quit and --save commandline switches. 2016-06-06 12:36:17 +02:00
printerpanel.py Configtool: fixed GUI crash when using DC extruder. 2016-07-30 11:02:29 +02:00
protectedfiles.py ARM: add a board configuration for Gen7-ARM. 2015-08-12 14:26:36 +02:00
sensorlist.py Configtool: don't color heater/sensor list items. 2015-05-31 11:27:12 +02:00
sensorpage.py Configtool: speed up startup with wx-tricks. 2016-10-26 22:00:21 +02:00
settings.py Configtool: add --quit and --save commandline switches. 2016-06-06 12:36:17 +02:00
thermistor.py Configtool: thermistor table entries are now distributed by ADC. 2015-07-27 18:04:41 +02:00
thermistorpresets.py Configtool: move thermistor presets into distribution file. 2015-05-20 23:31:38 +02:00
thermistortablefile.py thermistortablefile.py: fix output parameter list. 2016-10-26 20:32:45 +02:00