CppSerialization icon indicating copy to clipboard operation
CppSerialization copied to clipboard

Added zpp_bits performance benchmark.

Open eyalz800 opened this issue 2 years ago • 12 comments

Hope to get this included

eyalz800 avatar Aug 21 '22 10:08 eyalz800

Latest Visual Studio 2022:

       "Z:\projects\chronoxor\CppSerialization\temp\ALL_BUILD.vcxproj" (default target) (3) ->
       "Z:\projects\chronoxor\CppSerialization\temp\cppserialization-performance-zpp_serialize.vcxproj" (default target) (99) ->
       (ClCompile target) ->
         Z:\projects\chronoxor\CppSerialization\modules\zpp_bits/zpp_bits.h(1928,27): error C2672: 'zpp::bits::basic_out<ByteView>::serialize_one': no matching overloaded function found [Z:\projects\chronoxor\Cpp
       Serialization\temp\cppserialization-performance-zpp_serialize.vcxproj]
         Z:\projects\chronoxor\CppSerialization\modules\zpp_bits/zpp_bits.h(1927,1): error C3536: 'result': cannot be used before it is initialized [Z:\projects\chronoxor\CppSerialization\temp\cppserialization-pe
       rformance-zpp_serialize.vcxproj]
         Z:\projects\chronoxor\CppSerialization\modules\zpp_bits/zpp_bits.h(1928,54): error C2665: 'zpp::bits::failure': none of the 2 overloads could convert all the argument types [Z:\projects\chronoxor\CppSeri
       alization\temp\cppserialization-performance-zpp_serialize.vcxproj]
         Z:\projects\chronoxor\CppSerialization\modules\zpp_bits/zpp_bits.h(1930,1): error C2440: 'return': cannot convert from 'int' to 'zpp::bits::errc' [Z:\projects\chronoxor\CppSerialization\temp\cppserializa
       tion-performance-zpp_serialize.vcxproj]

chronoxor avatar Aug 21 '22 11:08 chronoxor

Oh wow, will check, do you have the full error because I don’t have VS? Also if you have visual studio on your CI can you approve for me to run on this so my pull request will pass the CI before merging?

eyalz800 avatar Aug 21 '22 11:08 eyalz800

Ok I found the error and reproduced it, but I am not sure currently how to fix because it looks like VS has an issue here unless I'm missing something:

https://raw.githubusercontent.com/eyalz800/zpp_bits/main/zpp_bits.h(1928): note: 'zpp::bits::errc zpp::bits::basic_out<ByteView>::serialize_one(auto (&)[Count])': could not deduce template argument for 'auto (&)[Count]' from 'char [10]'

eyalz800 avatar Aug 21 '22 12:08 eyalz800

Workaround, will merge soon https://github.com/eyalz800/zpp_bits/pull/88

eyalz800 avatar Aug 21 '22 12:08 eyalz800

@chronoxor fixed on my end with the patch above. Perhaps worth opening an issue to VS2022, I will consider doing so if I get free time.

eyalz800 avatar Aug 21 '22 12:08 eyalz800

Looks like an issue with absl include directories is preventing to compile when I execute from the CI - https://github.com/eyalz800/CppSerialization/runs/7939382559?check_suite_focus=true

2022-08-21T14:11:19.4328568Z In file included from /home/runner/work/CppSerialization/CppSerialization/proto/protobuf/trade.pb.cc:4:
2022-08-21T14:11:19.4329106Z In file included from /home/runner/work/CppSerialization/CppSerialization/proto/protobuf/trade.pb.h:28:
2022-08-21T14:11:19.4329638Z In file included from /home/runner/work/CppSerialization/CppSerialization/modules/protobuf/src/google/protobuf/generated_message_reflection.h:47:
2022-08-21T14:11:19.4331358Z /home/runner/work/CppSerialization/CppSerialization/modules/protobuf/src/google/protobuf/descriptor.h:71:10: fatal error: 'absl/synchronization/mutex.h' file not found
2022-08-21T14:11:19.4331984Z #include "absl/synchronization/mutex.h"
2022-08-21T14:11:19.4332827Z          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-08-21T14:11:19.6843233Z 1 error generated.
2022-08-21T14:11:19.6909804Z make[2]: *** [CMakeFiles/proto.dir/build.make:85: CMakeFiles/proto.dir/proto/protobuf/trade.pb.cc.o] Error 1
2022-08-21T14:11:19.6910562Z make[2]: *** Waiting for unfinished jobs....
2022-08-21T14:11:20.2410052Z make[1]: *** [CMakeFiles/Makefile2:1062: CMakeFiles/proto.dir/all] Error 2
2022-08-21T14:11:20.2411123Z make: *** [Makefile:146: all] Error 2
2022-08-21T14:11:20.2439622Z ##[error]Process completed with exit code 2.
2022-08-21T14:11:20.2497930Z Post job cleanup.
2022-08-21T14:11:20.3799112Z [command]/usr/bin/git version
2022-08-21T14:11:20.3802999Z git version 2.37.2
2022-08-21T14:11:20.3805424Z Temporarily overriding HOME='/home/runner/work/_temp/f7dcd589-ac83-41c2-8940-67fff39af2c3' before making global git config changes
2022-08-21T14:11:20.3805891Z Adding repository directory to the temporary git global config as a safe directory
2022-08-21T14:11:20.3806997Z [command]/usr/bin/git config --global --add safe.directory /home/runner/work/CppSerialization/CppSerialization
2022-08-21T14:11:20.3856439Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2022-08-21T14:11:20.3895642Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :
2022-08-21T14:11:20.4171791Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2022-08-21T14:11:20.4204830Z http.https://github.com/.extraheader
2022-08-21T14:11:20.4214870Z [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
2022-08-21T14:11:20.4253831Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :
2022-08-21T14:11:20.4706068Z Cleaning up orphan processes

eyalz800 avatar Aug 21 '22 14:08 eyalz800

Rebased.

eyalz800 avatar Aug 21 '22 21:08 eyalz800

Rebased

eyalz800 avatar Aug 23 '22 17:08 eyalz800

My results (I just ran mine only):

./cppserialization-performance-zpp_serialize                                                                                                                                                                                                                                                                              
[ 20%] Launching ZppBits-Serialize. Attempt 1...Done!
[ 40%] Launching ZppBits-Serialize. Attempt 2...Done!
[ 60%] Launching ZppBits-Serialize. Attempt 3...Done!
[ 80%] Launching ZppBits-Serialize. Attempt 4...Done!
[100%] Launching ZppBits-Serialize. Attempt 5...Done!
===============================================================================
CppBenchmark report. Version 1.0.2.0
===============================================================================
CPU architecture: Apple M1 Max
CPU logical cores: 10
CPU physical cores: 10
CPU clock speed: -1 Hz
CPU Hyper-Threading: disabled
RAM total: 64.000 GiB
RAM free: 3.074 GiB
===============================================================================
OS version: 21.4.0
OS bits: 64-bit
Process bits: 64-bit
Process configuration: release
Local timestamp: Tue Aug 23 20:25:33 2022
UTC timestamp: Tue Aug 23 17:25:33 2022
===============================================================================
Benchmark: ZppBits-Serialize
Attempts: 5
Duration: 5 seconds
-------------------------------------------------------------------------------
Phase: ZppBits-Serialize
Average time: 17 ns/op
Minimal time: 20 ns/op
Maximal time: 20 ns/op
Total time: 5.487 s
Total operations: 315929253
Total bytes: 38.256 GiB
Operations throughput: 57576878 ops/s
Bytes throughput: 6.994 GiB/s
Custom values:
        Size: 130
===============================================================================

./cppserialization-performance-zpp_deserialize                                                                                                                                                                                                                                                                            ─╯
[ 20%] Launching ZppBits-Deserialize. Attempt 1...Done!
[ 40%] Launching ZppBits-Deserialize. Attempt 2...Done!
[ 60%] Launching ZppBits-Deserialize. Attempt 3...Done!
[ 80%] Launching ZppBits-Deserialize. Attempt 4...Done!
[100%] Launching ZppBits-Deserialize. Attempt 5...Done!
===============================================================================
CppBenchmark report. Version 1.0.2.0
===============================================================================
CPU architecture: Apple M1 Max
CPU logical cores: 10
CPU physical cores: 10
CPU clock speed: -1 Hz
CPU Hyper-Threading: disabled
RAM total: 64.000 GiB
RAM free: 2.858 GiB
===============================================================================
OS version: 21.4.0
OS bits: 64-bit
Process bits: 64-bit
Process configuration: release
Local timestamp: Tue Aug 23 20:26:21 2022
UTC timestamp: Tue Aug 23 17:26:21 2022
===============================================================================
Benchmark: ZppBits-Deserialize
Attempts: 5
Duration: 5 seconds
-------------------------------------------------------------------------------
Phase: ZppBits-Deserialize
Average time: 17 ns/op
Minimal time: 21 ns/op
Maximal time: 21 ns/op
Total time: 5.756 s
Total operations: 321776202
Total bytes: 38.981 GiB
Operations throughput: 55898938 ops/s
Bytes throughput: 6.786 GiB/s
Custom values:
        Size: 130
===============================================================================

eyalz800 avatar Aug 23 '22 17:08 eyalz800

Managed to run the benchmark in the CI - https://github.com/eyalz800/CppSerialization/runs/8168287047?check_suite_focus=true

eyalz800 avatar Sep 03 '22 10:09 eyalz800

Looks like the PR passes the CI now

eyalz800 avatar Sep 06 '22 10:09 eyalz800