Could jmh respect system format settings on Windows or use "C" (simplest one) for machine-related output (CSV)?
lev at serebryakov.spb.ru
Tue Sep 20 14:07:28 UTC 2016
On 20.09.2016 16:48, Aleksey Shipilev wrote:
> If your applications use inconsistent locales, then neutral locale does
> not help: the locales for input app and output app would still be
> inconsistent. If your applications use consistent locales (e.g. agree on
IMHO, all machine-readable formats should use "C" locale. Period. CSV
is unlucky exception, where many aspects are implementation-defined, but
IMHO, software should try to be good citizen and use "C" locale. Again,
you could not produce XML or PostScript or PDF with "," as delimiter for
decimal numbers, it will be wrong. CVS is not so strict per RFC, but CVS
with "." will not violate RFC too.
Simple example: how should I send CSV files with results to my American
friend? Do I need to have "English/US" locale, with 12-hours clock,
MM/DD/YYYY date, and so on, only to exchange MACHINE-READABLE files,
which will almost never be read by eyes as-is, with my colleagues over
the pond? It is ridiculous.
> a neutral), then the problem is moot.
> It seems you have the former case:
>> I use Windows with Russian regional settings with CUSTOM decimal
>> delimiter (set to ".", dot, of course). (...skip...) JMH 1.13 outputs numbers
>> into CSV with comma! It is complete madness!
> I think the solution it to fix that configuration inconsistency.
Why is it inconsistency? It is custom locale, which is 100% supported
on my OS. Based on Russian, yes. I could do this on POSIX system too, at
it will be 100% standard complaint.
All system software works as expected. I configured "." as decimal
delimiter in my system and it works. It works in native Win32 software,
it works in QT-based software. Everywhere. But Java.
Ok, maybe here is more global question to Java support for locales
(looks like Java asks system only for "name" and use its own database of
settings which I could not change), but, again, IMHO, all
machine-readable formats should be locale-neutral.
Here is no "LANG=C java -jar jmh.jar" equivalent on Windows, unfortunately.
// Black Lion AKA Lev Serebryakov
More information about the jmh-dev