From: Hazen B. <hba...@ma...> - 2023-05-31 22:56:50
|
Github has an interesting feature which lets you browse the code and see the last commit that touched a particular part of the code. Using that it looks like saving and restoring the locale was added to the functions in src/plcore.c by Alan on Sep 7, 2009. The commit message: """ Protect all device driver calls using the (now) reentrant plsave_set_… …locale and plrestore_locale. The former saves the fundamental PLplot LC_NUMERIC locale and then sets the LC_NUMERIC locale to "C" for everything done by all device drivers. Of course, any library called by a device driver can also change the locale, but we guard against such changes affecting the rest of PLplot by using plrestore_locale to restore the fundamental PLplot LC_NUMERIC locale saved by plsave_set_locale. N.B. this logic allows the fundamental PLplot LC_NUMERIC locale (except for the parts like the device drivers and palette file reading that are protected by the combination of plsave_set_locale and plrestore_locale) to be any valid locale set by any application or library that calls the PLplot library. If that locale specifies comma decimal separators rather than period decimal separators, for example, then the PLplot core will automatically use those for for specifying axis labels. Those commas for axis labels are drawn by the PLplot core for the Hershey font device drivers or just propagate to the unicode device drivers as UCS4 arrays. Thus, in both cases, we get a comma decimal separator for axis labels (if that is what the fundamental PLplot LC_NUMERIC locale calls for) independently of the logic of the present commit that sets the LC_NUMERIC locale to "C" for all device driver code that is executed. svn path=/trunk/; revision=10383 """ -Hazen On 5/31/23 10:56, Phil Rosenberg wrote: > Sorry, I was wrong in my last email - removing the locale calls from plP_state as well (used to reset the width after a contour draw within plshade) I ended up with a 2.5 times speed increase > > Phil > > On Mon, 29 May 2023 at 00:38, Phil Rosenberg <p.d...@gm... <mailto:p.d...@gm...>> wrote: > > Hi all > I have been making further optimisations to the wxwidgets backen, as > I have still been finding it painfully slow for plshade calls. > It turned out that almost all the time within the backend (>99%) was > spent selecting pens and brushes and allocating memory for every > fill within the plshade call. Less that 1% was actually spent within > the rendering call to wxWidgets. I have made some good improvements > here. > > However, in addition to this, about 50% of the total execution time > is spent in the setlocale function. This is called before and after > each polygon fill in the core plplot code. > > I wondered if anyone really knows the purpose of these calls? > Perhaps they are to ensure we have consistent numeric > representations across regions? If so, then I don't really > understand why they are needed for polygon fills. > > Any thoughts would be welcome > Phil > > > > _______________________________________________ > Plplot-devel mailing list > Plp...@li... > https://lists.sourceforge.net/lists/listinfo/plplot-devel On 5/31/23 10:56, Phil Rosenberg wrote: > Sorry, I was wrong in my last email - removing the locale calls from > plP_state as well (used to reset the width after a contour draw within > plshade) I ended up with a 2.5 times speed increase > > Phil > > On Mon, 29 May 2023 at 00:38, Phil Rosenberg <p.d...@gm... > <mailto:p.d...@gm...>> wrote: > > Hi all > I have been making further optimisations to the wxwidgets backen, as > I have still been finding it painfully slow for plshade calls. > It turned out that almost all the time within the backend (>99%) was > spent selecting pens and brushes and allocating memory for every > fill within the plshade call. Less that 1% was actually spent within > the rendering call to wxWidgets. I have made some good improvements > here. > > However, in addition to this, about 50% of the total execution time > is spent in the setlocale function. This is called before and after > each polygon fill in the core plplot code. > > I wondered if anyone really knows the purpose of these calls? > Perhaps they are to ensure we have consistent numeric > representations across regions? If so, then I don't really > understand why they are needed for polygon fills. > > Any thoughts would be welcome > Phil > > > > _______________________________________________ > Plplot-devel mailing list > Plp...@li... > https://lists.sourceforge.net/lists/listinfo/plplot-devel |