← Back to team overview

kicad-developers team mailing list archive

Re: LOCALE_IO sucks

 

On Tue, Jul 18, 2017 at 04:42:28PM +0200, jp charras wrote:
> Le 18/07/2017 à 15:47, Chris Pavlina a écrit :
> > Yes, the goal would be to try to make the footprint parser entirely non-locale-sensitive so as not
> > to need to switch anyway. The problem with LOCALE_IO is that it's incompatible with threading
> > (especially on Windows where msys2 provides no concept of a thread-local locale), so there's no way
> > to background parsing. I really need to eliminate a GUI freeze on parse, people are not happy with it.
> > 
> > As for removing it entirely from other places too, this may be less feasible. For now I just want it
> > out of the footprint parser. Removing it in other places too may have to wait.
> 
> LOCALE_IO is used only to allow parsing and conversion (read or write) of float numbers.
> So using a custom function to manage float numbers footprint parser is doable.

Yeah - my concern with it is that it's really hard to see if it's had
any unintended consequences beyond that, despite that being its intended
purpose. It'll be a delicate surgery, no doubt.

> 
> However I am convinced the freeze time is mainly due to the time to download libs from Github or
> access and read the numerous files on a hard disk.

There are multiple causes of the freeze. The ROOT cause is that
LOCALE_IO has prevented me from fully moving everything to the
background. When I can do that, it can do whatever it needs to do in a
background thread and the UI should remain responsive. I already have
the framework in place and well tested for that, just have to eliminate
the last bit that can't be threaded.

> For files on my hard disk I am pretty sure 90% of the time is the time spent to read the files and
> 10% (and certainly less) is the parsing time.
> Why I am thinking that ?
> because (test made with 30 libraries, with one lib having 1000 .kicad_mod files) when I am using the
> same libraries stored on a SSD, the freeze time is 10% of the freeze time when using these libraries
> stored on a hard drive (the noise created by reading hundred or thousand of files lead me to think
> this time is mainly spent to move the heads of the hard drive).
> 
> Having said that, removing the need to switch current locale to "C" locale to read libraries is
> certainly a good thing.
> 
> > 
> > On Jul 18, 2017 7:12 AM, "Wayne Stambaugh" <stambaughw@xxxxxxxxx <mailto:stambaughw@xxxxxxxxx>> wrote:
> > 
> >     I have no objections as long as nothing gets broken and the code doesn't
> >     get more complicated (less readable).  LOCALE_IO exists in all of the
> >     plugins not just the kicad plugin so there is a lot of code to fix.  The
> >     reason LOCALE_IO exists is to hide resetting the locale on exceptions.
> >     I don't see how any other solution is going to result in cleaner code
> >     but I'm willing to entertain the idea.  Please test your changes
> >     thoroughly and submit a patch so we can test it and take a look at it
> >     before committing.
> > 
> >     On 7/17/2017 8:44 PM, Chris Pavlina wrote:
> >     > If I somehow found the time to strip LOCALE_IO completely out of the
> >     > footprint parser without changing the behavior, would anyone have any
> >     > religious objections or otherwise mourn the loss?
> >     >
> > 
> >     _______________________________________________
> >     Mailing list: https://launchpad.net/~kicad-developers <https://launchpad.net/%7Ekicad-developers>
> >     Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
> >     Unsubscribe : https://launchpad.net/~kicad-developers <https://launchpad.net/%7Ekicad-developers>
> >     More help   : https://help.launchpad.net/ListHelp <https://help.launchpad.net/ListHelp>
> > 
> > 
> > 
> > _______________________________________________
> > Mailing list: https://launchpad.net/~kicad-developers
> > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help   : https://help.launchpad.net/ListHelp
> > 
> 
> 
> -- 
> Jean-Pierre CHARRAS
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


References