← Back to team overview

kicad-developers team mailing list archive

Re: Why pcbnew is statting so much?


On 8/4/2013 1:03 PM, Lorenzo Marcantonio wrote:
Curious behaviour of pcbnew, I don't know since when it does that...

It happened that I just had a .kicad_pcb file lying in the home
directory. No project, only the board file. Opened it using "pcbnew
file.kicad_pcb" as usual. After the "Debug: Loading global footprint
table file: /home/lomarcan/.fp-lib-table" (which doesn't exist, anyway,
and IIRC isn't even enabled in cmake) it took forever; then started as

Further examination with strace shown that:
- It stats the .fp-lib-table
- Get the cwd (i.e. the home)
- Tries to find the corresponding .pro, the the .pro from the template
- Stats the /usr/share/kicad/modules
- Stats the *whole fscking home recursively* so it takes a long time
- Do an openat of /usr/share/kicad/modules and stats all the .mod inside

Is this something like ``looking under the board directory for
modules''? AFAIK the new module storage is something like directories
for libraries and files for modules (correct me if I'm wrong). I don't
know the design details so I don't know if a full recursion is the
correct algorithm to find stuff. My home at home has 300Kfiles, at work
there are 500K or so... the cache helps but anyway it doesn't seem
correct to me:P

I think that in this case pcbnew is trying to hard to be smart:P If that
is the case wouldn't be useful add a 'signature file' to a module
directory (something like .im_a_kicad_module_lib inside...) to prune the

This is because I attempted to figure out where the default KiCad footprint libraries are installed in order the set the $KISYSMOD environment variable so the footprint library table can find them. This is accomplished by iterating over all of the library search paths to find the path with the greatest number of *.mod files. I am not terribly happy with this solution either. I have a better solution in mind and will #ifdef/#endif this code out in my next commit so it doesn't get included for non-USE_FP_LIB_TABLE builds. I apologize for the annoyance. I've been on vacation and busy training for a bike race next weekend so I haven't spent as much time working on KiCad as I normally do. Hopefully it wont be too much longer. I'm close to having the footprint library table code done for CvPcb. Please bear with me for a few more weeks.


Follow ups