benchmark icon indicating copy to clipboard operation
benchmark copied to clipboard

On Windows there is formating error when using compare.py

Open monamimani opened this issue 7 years ago • 7 comments

So I am trying to compare my benchmark but it is really hard because the output contains garbage characters.

python.exe D:_Dev\Playground\gBenchmarkVulkan/bazel-gbenchmarkvulkan/external/gbenchmark/tools/compare.py filters D:_Dev\Playground\gBenchmarkVulkan/benchmark.json NoExcept WithExcept Comparing NoExcept to WithExcept (from D:_Dev\Playground\gBenchmarkVulkan/benchmark.json) Benchmark Time CPU Time Old Time New CPU Old CPU New

[92mvkInstanceCreationUnique[NoExcept vs. WithExcept][0m[97m +0.0067[0m[97m +0.0250[0m 107057091 107769236[0m 56818182 58238636

benchmark.txt

monamimani avatar Jul 18 '18 00:07 monamimani

I don't see anything odd in the attached JSON. Might this be a windows python interpreter issue?

dmah42 avatar Jul 23 '18 11:07 dmah42

I created an other issue for the json, what is wrong is the backslashes they should be escaped, or slashes or when the field is read to be canonalized.) The problem that i am reporting here is the output to the console. Those characters � and [92. Either it is reading bad memory or there is a locale issue, or something else.

monamimani avatar Aug 03 '18 20:08 monamimani

I believe the issue is about Unicode. I looked at the python code and in report.py in the function generate_difference_report the var first_line is an ASCII string but in the JSON object, the strings are Unicode and then later in the function color_format the strings are formatted with an ASCII fmt_str.

I believe this is the culprit for the bad display of the characters.

I guess the solution is to go all ASCII or all Unicode, I am just not sure with the one you want.

monamimani avatar Aug 17 '18 18:08 monamimani

Perhaps these ascii escape sequences are simply too advanced for that windows console? Is there an unicode alternative for them? If not, simply disabling formatting for incompliant output devices may be the solution.

LebedevRI avatar Aug 17 '18 20:08 LebedevRI

I just ran into this problem and it looks like it's the color output that's the problem. If I disable the colors, I don't get any garbage characters. So at least there's a workaround

HenningJ avatar May 21 '19 15:05 HenningJ

I just ran into this problem and it looks like it's the color output that's the problem. If I disable the colors, I don't get any garbage characters. So at least there's a workaround

I just tried v1.5.0 with this command line F:_Dev\Playground\gBenchmarkVulkan\bazel-gbenchmarkvulkan\external\gbenchmark\tools> python.exe .\compare.py filters f:_Dev\Playground\gBenchmarkVulkan\benchmark.json NoExcept WithExcept --benchmark_color=false

and I still get the wrong character in the console Maybe there is another way to disable the colors.? In anycase, I never had any colors in the compare console out.

monamimani avatar Jun 13 '19 03:06 monamimani

If I remember correctly, there is no color command line argument. I disabled the colors directly in the color_format() function in report.py

HenningJ avatar Jun 13 '19 08:06 HenningJ