Thread pools are long-lasting executors that have close to zero overhead
when launching new jobs. This is advantageous over creating new threads
as we can use this for threading smalling jobs and smaller quanta. It
also avoids the heuristics needed to determine the optimal number of
threads to spawn
wxTextFile uses wxFile which uses write syscalls which means its unbuffered.
This makes file IO more expensive against network shares where it will flush far too aggressively.
wxTextFile is fine for reads however.
Cache the footprint info on disk (in the project).
Move timestamp-generation (and checking) to the filesystem so the
above will be bullet-proof.
Rewrite some wxWidgets classes for performance (see common.h).
There are three related changes here to harden our handling of threads
in the footprint async loader.
1) Footprint async loader explicitly aborts any remaining loader threads
on exit.
2) We protect the thread join by a mutex
3) We do not pause during no-wait routines
When starting async processes, we need to have a way to stop the process
before releasing memory. Descoping FOOTPRINT_ASYNC_LOADER while the
threads were still running could cause crashes depending on the memory
structure. To avoid this we define clear procedures for exiting a
running async processes and call these when exiting.
Fixes: lp:1772909
* https://bugs.launchpad.net/kicad/+bug/1772909
Also removes parallel implementation in favour of using the
normal one (with a new wxGauge-backed PROGRESS_REPORTER).
Fixes: lp:1764196
* https://bugs.launchpad.net/kicad/+bug/1764196
Also update the rest of the symbol-chooser usage to current
specs, including examining the timestamp to see if the list
needs loading at all.
Partial fix to: lp:1760936
* https://bugs.launchpad.net/kicad/+bug/1760936
While we already cache the loaded footprint files, parsing said files
into the list is also time-intensive. Since the FOOTPRINT_LIST is
already hash-stamped against the current timestamps of the files that
make up the list, sharing a single copy of the list is quite
straight-forward.
Too many external applications fail to touch the parent directory.
Also removes FP_CACHE_ITEM lastMod times and dirty flags as we've
always loaded libraries atomically anyway.
Claws back some of the performance lost by being more efficient
with cache management for sequential calls to Enumerate and then
Load.
Fixes: lp:1750936
* https://bugs.launchpad.net/kicad/+bug/1750936
Smartens the cache freshness checking, and adds checksums of
constituent-directory last-mod-dates to the footprint info
list.
Also inserts the dataPtrs into the list at the same time as
the text to keep wxWidgets from measuring the width of the
text twice (yes, really). And converts the list to default-
column widths in case the wxWidgets patch is present to
greatly speed list creation (by not measuring all that text).
On my machine drops the first-load time from 4s to 2.5s and
the subsequent-load times from 2.5s to < 1s. With the
wxWidgets patch subsequent-loads become near-instantaneous.
- DIALOG_CHOOSE_COMPONENT has footprint select widget
- FOOTPRINT_SELECT_WIDGET
- FOOTPRINT_CHOICE widget (customized wxComboCtrl)
- FOOTPRINT_FILTER class
- FOOTPRINT_INFO rework:
- FOOTPRINT_ASYNC_LOADER to load without freezing UI
- Rewrite loader threads as queue-driven thread pool
- Make FOOTPRINT_INFO available via kiway
- FP_LIB_TABLE::PrefetchLib
- Access to global fp-lib-table via kiway
- SYNC_QUEUE threadsafe queue template
- Remove KICAD_FOOTPRINT_SELECTOR build option