← Back to team overview

kicad-developers team mailing list archive

Re: Github plugin.

 

The GITHUB plugin is sluggish in the module viewer and here is why.  The module viewer
code is not making any effort to keep the current PLUGIN in RAM.

This causes numerous unnecessary hits against GITHUB, only to retrieve information that
should already be cached in the PLUGIN.  Although an effort is made to cache a list of
footprints, this is not the same as keeping the PLUGIN's cache, by keeping the PLUGIN
alive for as long as the currently selected library is alive.

Basically, it is a mess.

I instrumented two API functions, FootprintEnumerate() and FootprintLoad() with printf()s
which show the "this" pointer and aLibraryPath.  At first I thought the problem was
internal to GITHUB plugin, but it was not, and it will be a problem using ANY PLUGIN, not
just GITHUB.  Probably the KICAD_PLUGIN is a lot slower than it needs to be.



Here we get the list of footprints from aLibraryPath:

FootprintEnumerate: this:0x220f7b0
aLibraryPath:'https://github.com/CarlPoirier/BNC-Sockets_RevA'


Here we cache the library info:
cacheLib: this:0x220f7b0  m_lib_path:''
aLibraryPath:'https://github.com/CarlPoirier/BNC-Sockets_RevA'

and save the library path:
cacheLib2: this:0x220f7b0  m_lib_path:'https://github.com/CarlPoirier/BNC-Sockets_RevA'
aLibraryPath:'https://github.com/CarlPoirier/BNC-Sockets_RevA'



Here we load the first footprint, even though it is not shown yet.
FootprintLoad: this:0x220f7b0  aLibraryPath:'https://github.com/CarlPoirier/BNC-Sockets_RevA'

Here we load it again, don't know why:
FootprintLoad: this:0x220f7b0  aLibraryPath:'https://github.com/CarlPoirier/BNC-Sockets_RevA'

Re-cache the *entire* library information by hitting https://github.com again!
(Please don't)  Notice the "this" pointer has changed, somebody dropped the old
PLUGIN pointer.  This is the reason for the sluggishness.
FootprintLoad: this:0x22119e0  aLibraryPath:'https://github.com/CarlPoirier/BNC-Sockets_RevA'

Cache the info
cacheLib: this:0x22119e0  m_lib_path:''
aLibraryPath:'https://github.com/CarlPoirier/BNC-Sockets_RevA'
cacheLib2: this:0x22119e0  m_lib_path:'https://github.com/CarlPoirier/BNC-Sockets_RevA'
aLibraryPath:'https://github.com/CarlPoirier/BNC-Sockets_RevA'

Pick a new footprint in the UI, but too bad the PLUGIN is being reloaded AGAIN!
FootprintLoad: this:0x21e12b0  aLibraryPath:'https://github.com/CarlPoirier/BNC-Sockets_RevA'
cacheLib: this:0x21e12b0  m_lib_path:''
aLibraryPath:'https://github.com/CarlPoirier/BNC-Sockets_RevA'
cacheLib2: this:0x21e12b0  m_lib_path:'https://github.com/CarlPoirier/BNC-Sockets_RevA'
aLibraryPath:'https://github.com/CarlPoirier/BNC-Sockets_RevA'


Continue with the inefficient strategy:

FootprintLoad: this:0x2224f60  aLibraryPath:'https://github.com/CarlPoirier/BNC-Sockets_RevA'
cacheLib: this:0x2224f60  m_lib_path:''
aLibraryPath:'https://github.com/CarlPoirier/BNC-Sockets_RevA'
cacheLib2: this:0x2224f60  m_lib_path:'https://github.com/CarlPoirier/BNC-Sockets_RevA'
aLibraryPath:'https://github.com/CarlPoirier/BNC-Sockets_RevA'
FootprintEnumerate: this:0x22376c0
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
cacheLib: this:0x22376c0  m_lib_path:''
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
cacheLib2: this:0x22376c0
m_lib_path:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
FootprintLoad: this:0x22376c0
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
FootprintLoad: this:0x22376c0
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
FootprintLoad: this:0x22376c0
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
FootprintLoad: this:0x22376c0
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
FootprintLoad: this:0x22376c0
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
FootprintLoad: this:0x22376c0
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
FootprintLoad: this:0x2210ac0
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
cacheLib: this:0x2210ac0  m_lib_path:''
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
cacheLib2: this:0x2210ac0
m_lib_path:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
FootprintLoad: this:0x22357f0
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
cacheLib: this:0x22357f0  m_lib_path:''
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
cacheLib2: this:0x22357f0
m_lib_path:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'
aLibraryPath:'https://github.com/CarlPoirier/Buzzer_Beeper_RevA_25Oct2010'


Follow ups

References