Skip to content

Improving performancy by reducing creation of std::locale objects and use of std::locale::global#135

Open
ytterx wants to merge 2 commits intop-ranav:masterfrom
ytterx:reduce-std_locale-object-creation
Open

Improving performancy by reducing creation of std::locale objects and use of std::locale::global#135
ytterx wants to merge 2 commits intop-ranav:masterfrom
ytterx:reduce-std_locale-object-creation

Conversation

@ytterx
Copy link
Copy Markdown

@ytterx ytterx commented Apr 17, 2026

During performance testing where a lot of calls to tabulate where done, we noticed that a lot of time was spent in the creation of std::locale objects.
Instead of storing std::string we store a std::locale object to prevent the on-the-fly creation of these objects.
Also std::local::global should be avoided if possible (#114), using .imbue on the ostream directly instead.

This change expands on #126

I also slightly modified the fix done in #110 (actually done in #119? 110 can also be closed) by moving the setting of the locale to be done later then the check (no need to first get the locale, if we're returning early..)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant