Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #121424
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: We have a new standard! |
| Date | 2025-01-07 21:15 -0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <86a5c1antv.fsf@linuxsc.com> (permalink) |
| References | <C++-20241227154547@ram.dialup.fu-berlin.de> <20250101182527.00004b2f@yahoo.com> <vl49dp$2uedm$1@dont-email.me> <86msg9a9t1.fsf@linuxsc.com> <vl5pte$3a2v3$1@dont-email.me> |
Paavo Helde <eesnimi@osa.pri.ee> writes: > On 02.01.2025 10:39, Tim Rentsch wrote: > >> Paavo Helde <eesnimi@osa.pri.ee> writes: >> >> [...] >> >>> Half of the slowness of both in C printf() and C++ streams comes >>> from the locale support, [...] >> >> I find this assertion very hard to believe (specifically, for >> printf(); I might guess that C++ streams have similar >> performance characteristics, but I don't have nearly as much >> experience with C++ streams as I do with printf()). >> >> Is there anything else you can say about it besides an >> unsupported assertion? > > Probably you were misled by my vague word usage. I said "half of the > slowness", not "half of the total time". As "slowness" is nowhere > exactly defined, this was just a figure of speech, no need to get > overly upset about that. I'm not upset, just disappointed. I consider you one of the better contributors in the newsgroups, and so it's surprising to see a statement from you with zero information content. > Anyway, I have profiled the writing of large CSV tables (multi-GB) > which was deemed too slow. 90% of time was spent in sprintf() calls, > from which 10% was spent in locale-related routines, presumably for > checking that the global process locale has not changed during the > last microsecond. Considering that our CSV file format had to always > use the fixed C-locale format anyway, this locale checking was > something which was absolutely unneeded. The 10% number is interesting, and disappointing. Surely the authors of the standard library implementation could have done better. Incidentally, I did a measurement of the cost of localeconv() on my test server (running Ubuntu), and that gave a result in line with your 10% number. > We tried to parallelize the writing, expecting to increase the speed N > times by using N threads, but alas, as the locale is a global > thread-shared object, now the threads started to fight over it and the > performance did not scale nowhere near to our expectations. (The > thread-specific locales were not available an all needed platforms). Does the C standard (or the C++ standard) allow locale information to be thread-specific? I don't see anything in the C standard that looks like the <locale.h> functions can be anything but global. I haven't looked at what C++ allows. > We resolved it finally by using std::to_chars() for integer data and > Google's double-conversion library for floating-point data (our C++ > implementations did not support std::to_chars() on floating-point data > on all needed platforms at that time). It's disappointing that the C standard (and I assume also the C++ standard) doesn't provide conversion functions that don't use global locale information. Oh, come to think of it, I think I saw some C++ functions (in which C++ standard I don't know) that pass locale information in explicitly, which is probably what you were alluding to above.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: We have a new standard! Michael S <already5chosen@yahoo.com> - 2025-01-01 18:25 +0200
Re: We have a new standard! Muttley@dastardlyhq.com - 2025-01-01 16:33 +0000
Re: We have a new standard! Ross Finlayson <ross.a.finlayson@gmail.com> - 2025-01-01 09:41 -0800
Re: We have a new standard! David Brown <david.brown@hesbynett.no> - 2025-01-02 08:06 +0100
Re: We have a new standard! Muttley@dastardlyhq.com - 2025-01-02 09:23 +0000
Re: We have a new standard! David Brown <david.brown@hesbynett.no> - 2025-01-02 13:51 +0100
Re: We have a new standard! Muttley@DastardlyHQ.org - 2025-01-02 14:07 +0000
Re: We have a new standard! David Brown <david.brown@hesbynett.no> - 2025-01-02 17:54 +0100
Re: We have a new standard! Muttley@DastardlyHQ.org - 2025-01-02 17:15 +0000
Re: We have a new standard! Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-01-02 13:58 -0800
Re: We have a new standard! Muttley@DastardlyHQ.org - 2025-01-03 10:13 +0000
Re: We have a new standard! Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-01-03 11:22 -0800
Re: We have a new standard! Muttley@dastardlyhq.com - 2025-01-04 10:17 +0000
Re: We have a new standard! David Brown <david.brown@hesbynett.no> - 2025-01-04 12:31 +0100
Re: We have a new standard! Muttley@dastardlyhq.com - 2025-01-04 11:34 +0000
Re: We have a new standard! David Brown <david.brown@hesbynett.no> - 2025-01-04 14:01 +0100
Re: We have a new standard! Muttley@dastardlyhq.com - 2025-01-04 15:49 +0000
Re: We have a new standard! Ross Finlayson <ross.a.finlayson@gmail.com> - 2025-01-03 17:42 -0800
Re: We have a new standard! Sam <sam@email-scan.com> - 2025-01-02 15:20 -0500
Re: We have a new standard! David Brown <david.brown@hesbynett.no> - 2025-01-03 13:43 +0100
Re: We have a new standard! Sam <sam@email-scan.com> - 2025-01-03 08:11 -0500
Re: We have a new standard! Paavo Helde <eesnimi@osa.pri.ee> - 2025-01-03 16:33 +0200
Re: We have a new standard! Sam <sam@email-scan.com> - 2025-01-03 10:50 -0500
Re: We have a new standard! Muttley@DastardlyHQ.org - 2025-01-03 16:09 +0000
Re: We have a new standard! Sam <sam@email-scan.com> - 2025-01-03 11:53 -0500
Re: We have a new standard! Muttley@dastardlyhq.com - 2025-01-03 17:10 +0000
Re: We have a new standard! Sam <sam@email-scan.com> - 2025-01-03 12:14 -0500
Re: We have a new standard! Muttley@dastardlyhq.com - 2025-01-04 10:13 +0000
Re: We have a new standard! David Brown <david.brown@hesbynett.no> - 2025-01-03 18:17 +0100
Re: We have a new standard! Sam <sam@email-scan.com> - 2025-01-03 13:58 -0500
Re: We have a new standard! David Brown <david.brown@hesbynett.no> - 2025-01-04 12:39 +0100
Re: We have a new standard! Sam <sam@email-scan.com> - 2025-01-04 09:56 -0500
Re: We have a new standard! Paavo Helde <eesnimi@osa.pri.ee> - 2025-01-03 21:46 +0200
Re: We have a new standard! Sam <sam@email-scan.com> - 2025-01-03 21:06 -0500
Re: We have a new standard! Ross Finlayson <ross.a.finlayson@gmail.com> - 2025-01-03 18:32 -0800
Re: We have a new standard! Paavo Helde <eesnimi@osa.pri.ee> - 2025-01-04 20:08 +0200
Re: We have a new standard! Sam <sam@email-scan.com> - 2025-01-04 14:46 -0500
Re: We have a new standard! wij <wyniijj5@gmail.com> - 2025-01-05 07:14 +0800
Re: We have a new standard! Muttley@DastardlyHQ.org - 2025-01-06 08:38 +0000
Re: We have a new standard! Chris Ahlstrom <OFeem1987@teleworm.us> - 2025-01-07 08:40 -0500
Re: We have a new standard! Muttley@DastardlyHQ.org - 2025-01-07 14:04 +0000
Re: We have a new standard! Chris Ahlstrom <OFeem1987@teleworm.us> - 2025-01-08 14:52 -0500
Re: We have a new standard! Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-01-08 13:31 -0800
Re: We have a new standard! Muttley@DastardlyHQ.org - 2025-01-09 08:39 +0000
Re: We have a new standard! Sam <sam@email-scan.com> - 2025-01-07 21:32 -0500
Re: We have a new standard! Ross Finlayson <ross.a.finlayson@gmail.com> - 2025-01-03 17:49 -0800
Re: We have a new standard! David Brown <david.brown@hesbynett.no> - 2025-01-03 17:12 +0100
Re: We have a new standard! Sam <sam@email-scan.com> - 2025-01-03 11:56 -0500
Re: We have a new standard! Michael S <already5chosen@yahoo.com> - 2025-01-02 17:35 +0200
Re: We have a new standard! David Brown <david.brown@hesbynett.no> - 2025-01-02 17:57 +0100
Re: We have a new standard! Michael S <already5chosen@yahoo.com> - 2025-01-02 19:55 +0200
Re: We have a new standard! Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-01-02 13:40 -0800
Re: We have a new standard! David Brown <david.brown@hesbynett.no> - 2025-01-03 09:42 +0100
Re: We have a new standard! Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-01-02 13:38 -0800
Re: We have a new standard! Muttley@DastardlyHQ.org - 2025-01-03 10:09 +0000
Re: We have a new standard! Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-01-03 11:19 -0800
Re: We have a new standard! Muttley@dastardlyhq.com - 2025-01-04 10:15 +0000
Re: We have a new standard! Paavo Helde <eesnimi@osa.pri.ee> - 2025-01-01 22:43 +0200
Re: We have a new standard! David Brown <david.brown@hesbynett.no> - 2025-01-02 07:56 +0100
Re: We have a new standard! Tim Rentsch <tr.17687@z991.linuxsc.com> - 2025-01-02 00:39 -0800
Re: We have a new standard! Paavo Helde <eesnimi@osa.pri.ee> - 2025-01-02 12:31 +0200
Re: We have a new standard! Michael S <already5chosen@yahoo.com> - 2025-01-02 14:59 +0200
Re: We have a new standard! Paavo Helde <eesnimi@osa.pri.ee> - 2025-01-02 15:50 +0200
Re: We have a new standard! Tim Rentsch <tr.17687@z991.linuxsc.com> - 2025-01-07 21:15 -0800
Re: We have a new standard! Paavo Helde <eesnimi@osa.pri.ee> - 2025-01-08 08:44 +0200
Re: We have a new standard! Michael S <already5chosen@yahoo.com> - 2025-01-08 11:44 +0200
Re: We have a new standard! James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-01-08 15:04 -0500
Re: We have a new standard! Tim Rentsch <tr.17687@z991.linuxsc.com> - 2025-01-14 08:49 -0800
Re: We have a new standard! Tim Rentsch <tr.17687@z991.linuxsc.com> - 2025-01-14 09:12 -0800
Re: We have a new standard! Paavo Helde <eesnimi@osa.pri.ee> - 2025-01-14 19:53 +0200
Re: We have a new standard! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-01-08 14:43 -0800
Re: We have a new standard! scott@slp53.sl.home (Scott Lurndal) - 2025-01-02 20:51 +0000
Re: We have a new standard! Michael S <already5chosen@yahoo.com> - 2025-01-02 16:47 +0200
csiph-web