async_simple icon indicating copy to clipboard operation
async_simple copied to clipboard

async_simple_coro_test.exe with cl.exe /fsanitize=address produce negative time

Open meongmeongasd opened this issue 2 years ago • 1 comments

Search before asking

  • [x] I searched the issues and found no similar issues.

What happened + What you expected to happen

release

C:\Github\async_simple\build>async_simple_coro_test.exe
[==========] Running 37 tests from 8 test suites.
[----------] Global test environment set-up.
[----------] 4 tests from ConditionVariableTest
[ RUN      ] ConditionVariableTest.testSingleWait
[       OK ] ConditionVariableTest.testSingleWait (0 ms)
[ RUN      ] ConditionVariableTest.testMultiWait
[       OK ] ConditionVariableTest.testMultiWait (11 ms)
[ RUN      ] ConditionVariableTest.testSingleWaitPredicate
[       OK ] ConditionVariableTest.testSingleWaitPredicate (13 ms)
[ RUN      ] ConditionVariableTest.testSingleWaitPredicateWithScopeLock
[       OK ] ConditionVariableTest.testSingleWaitPredicateWithScopeLock (0 ms)
[----------] 4 tests from ConditionVariableTest (31 ms total)

[----------] 1 test from FutureAwaiterTest
[ RUN      ] FutureAwaiterTest.testWithFuture
[       OK ] FutureAwaiterTest.testWithFuture (1028 ms)
[----------] 1 test from FutureAwaiterTest (1029 ms total)

[----------] 23 tests from LazyTest
[ RUN      ] LazyTest.testSimpleAsync
[       OK ] LazyTest.testSimpleAsync (0 ms)
[ RUN      ] LazyTest.testSimpleAsync2
[       OK ] LazyTest.testSimpleAsync2 (0 ms)
[ RUN      ] LazyTest.testVia
[       OK ] LazyTest.testVia (0 ms)
[ RUN      ] LazyTest.testNoVia
[       OK ] LazyTest.testNoVia (0 ms)
[ RUN      ] LazyTest.testYield
[       OK ] LazyTest.testYield (431 ms)
[ RUN      ] LazyTest.testVoid
[       OK ] LazyTest.testVoid (0 ms)
[ RUN      ] LazyTest.testReadyCoro
[       OK ] LazyTest.testReadyCoro (0 ms)
[ RUN      ] LazyTest.testExecutor
[       OK ] LazyTest.testExecutor (0 ms)
[ RUN      ] LazyTest.testNoCopy
[       OK ] LazyTest.testNoCopy (0 ms)
[ RUN      ] LazyTest.testDetachedCoroutine
[       OK ] LazyTest.testDetachedCoroutine (11 ms)
[ RUN      ] LazyTest.testCollectAll
[       OK ] LazyTest.testCollectAll (4 ms)
[ RUN      ] LazyTest.testCollectAllBatched
Lazy: collectAll_maxConcurrency_is_task_num: 213.798 ms
Lazy: collectAll_maxConcurrency_is_10: 228.739 ms
Lazy: collectAll_maxConcurrency_is_10_inAlloc: 222.304 ms
Lazy: collectAll_maxConcurrency_is_10_inAlloc_outAlloc: 223.025 ms
RescheduleLazy: collectAll_maxConcurrency_is_task_num: 216.932 ms
RescheduleLazy: collectAll_maxConcurrency_is_10: 229.375 ms
RescheduleLazy: collectAll_maxConcurrency_is_10_inAlloc: 235.067 ms
RescheduleLazy: collectAll_maxConcurrency_is_10_inAlloc_outAlloc: 235.808 ms
[       OK ] LazyTest.testCollectAllBatched (2949 ms)
[ RUN      ] LazyTest.testCollectAllWithAllocator
[       OK ] LazyTest.testCollectAllWithAllocator (1 ms)
[ RUN      ] LazyTest.testCollectAllVariadic
[       OK ] LazyTest.testCollectAllVariadic (1 ms)
[ RUN      ] LazyTest.testCollectAny
[       OK ] LazyTest.testCollectAny (133 ms)
[ RUN      ] LazyTest.testCollectAnyVariadic
[       OK ] LazyTest.testCollectAnyVariadic (139 ms)
[ RUN      ] LazyTest.testException
[       OK ] LazyTest.testException (0 ms)
[ RUN      ] LazyTest.testContext
[       OK ] LazyTest.testContext (1 ms)
[ RUN      ] LazyTest.testDestroyOrder
0
[       OK ] LazyTest.testDestroyOrder (0 ms)
[ RUN      ] LazyTest.testLazyPerf
             lazy 30 loop call: 1363 ns
            lazy 30 chain call: 3271 ns
[       OK ] LazyTest.testLazyPerf (25 ms)
[ RUN      ] LazyTest.testcollectAllParallel
40552
20340
41156
14996
14744
41156
30084
30084
[       OK ] LazyTest.testcollectAllParallel (33 ms)
[ RUN      ] LazyTest.testBatchedcollectAll
input tasks maybe run not in different thread, thread id:
31176
6584
31176
6584
31176
6584
31176
expect[0]: 1, result[0]: 1
expect[1]: 5, result[1]: 5
expect[2]: 2, result[2]: 2
expect[3]: 6, result[3]: 6
expect[4]: 3, result[4]: 3
expect[5]: 7, result[5]: 7
expect[6]: 4, result[6]: 4
expect[7]: 8, result[7]: 8
[       OK ] LazyTest.testBatchedcollectAll (577 ms)
[ RUN      ] LazyTest.testDetach
[       OK ] LazyTest.testDetach (0 ms)
[----------] 23 tests from LazyTest (4332 ms total)

[----------] 2 tests from MutexTest
[ RUN      ] MutexTest.testLock
[       OK ] MutexTest.testLock (0 ms)
[ RUN      ] MutexTest.testAsyncLock
[       OK ] MutexTest.testAsyncLock (4041 ms)
[----------] 2 tests from MutexTest (4043 ms total)

[----------] 1 test from SleepTest
[ RUN      ] SleepTest.testSleep
1013
906
13208
13208
906
[       OK ] SleepTest.testSleep (2829 ms)
[----------] 1 test from SleepTest (2829 ms total)

[----------] 3 tests from SpinLockTest
[ RUN      ] SpinLockTest.testLockImmediately
[       OK ] SpinLockTest.testLockImmediately (0 ms)
[ RUN      ] SpinLockTest.testLockYield
[       OK ] SpinLockTest.testLockYield (0 ms)
[ RUN      ] SpinLockTest.testSyncLock
[       OK ] SpinLockTest.testSyncLock (8 ms)
[----------] 3 tests from SpinLockTest (11 ms total)

[----------] 2 tests from TraitsTest
[ RUN      ] TraitsTest.testHasCoAwaitMethod
[       OK ] TraitsTest.testHasCoAwaitMethod (0 ms)
[ RUN      ] TraitsTest.testHasCoAwaitOperator
[       OK ] TraitsTest.testHasCoAwaitOperator (0 ms)
[----------] 2 tests from TraitsTest (2 ms total)

[----------] 1 test from ViaCoroutineTest
[ RUN      ] ViaCoroutineTest.SimplecheckoutEQcheckin
[       OK ] ViaCoroutineTest.SimplecheckoutEQcheckin (0 ms)
[----------] 1 test from ViaCoroutineTest (0 ms total)

[----------] Global test environment tear-down
[==========] 37 tests from 8 test suites ran. (12287 ms total)
[  PASSED  ] 37 tests.

release with asan

C:\Github\async_simple\build>async_simple_coro_test.exe
[==========] Running 37 tests from 8 test suites.
[----------] Global test environment set-up.
[----------] 4 tests from ConditionVariableTest
[ RUN      ] ConditionVariableTest.testSingleWait
[       OK ] ConditionVariableTest.testSingleWait (1 ms)
[ RUN      ] ConditionVariableTest.testMultiWait
[       OK ] ConditionVariableTest.testMultiWait (9 ms)
[ RUN      ] ConditionVariableTest.testSingleWaitPredicate
[       OK ] ConditionVariableTest.testSingleWaitPredicate (14 ms)
[ RUN      ] ConditionVariableTest.testSingleWaitPredicateWithScopeLock
[       OK ] ConditionVariableTest.testSingleWaitPredicateWithScopeLock (0 ms)
[----------] 4 tests from ConditionVariableTest (33 ms total)

[----------] 1 test from FutureAwaiterTest
[ RUN      ] FutureAwaiterTest.testWithFuture
[       OK ] FutureAwaiterTest.testWithFuture (1023 ms)
[----------] 1 test from FutureAwaiterTest (1024 ms total)

[----------] 23 tests from LazyTest
[ RUN      ] LazyTest.testSimpleAsync
[       OK ] LazyTest.testSimpleAsync (0 ms)
[ RUN      ] LazyTest.testSimpleAsync2
[       OK ] LazyTest.testSimpleAsync2 (0 ms)
[ RUN      ] LazyTest.testVia
[       OK ] LazyTest.testVia (0 ms)
[ RUN      ] LazyTest.testNoVia
[       OK ] LazyTest.testNoVia (0 ms)
[ RUN      ] LazyTest.testYield
[       OK ] LazyTest.testYield (430 ms)
[ RUN      ] LazyTest.testVoid
[       OK ] LazyTest.testVoid (0 ms)
[ RUN      ] LazyTest.testReadyCoro
[       OK ] LazyTest.testReadyCoro (0 ms)
[ RUN      ] LazyTest.testExecutor
[       OK ] LazyTest.testExecutor (1 ms)
[ RUN      ] LazyTest.testNoCopy
[       OK ] LazyTest.testNoCopy (0 ms)
[ RUN      ] LazyTest.testDetachedCoroutine
[       OK ] LazyTest.testDetachedCoroutine (7 ms)
[ RUN      ] LazyTest.testCollectAll
[       OK ] LazyTest.testCollectAll (7 ms)
[ RUN      ] LazyTest.testCollectAllBatched
Lazy: collectAll_maxConcurrency_is_task_num: 1120.16 ms
Lazy: collectAll_maxConcurrency_is_10: -1864815796 ns
Lazy: collectAll_maxConcurrency_is_10_inAlloc: -1863545796 ns
Lazy: collectAll_maxConcurrency_is_10_inAlloc_outAlloc: -1856720496 ns
RescheduleLazy: collectAll_maxConcurrency_is_task_num: 1077.68 ms
RescheduleLazy: collectAll_maxConcurrency_is_10: -1961193996 ns
RescheduleLazy: collectAll_maxConcurrency_is_10_inAlloc: 1502.98 ms
RescheduleLazy: collectAll_maxConcurrency_is_10_inAlloc_outAlloc: 1551.49 ms
[       OK ] LazyTest.testCollectAllBatched (128874 ms)
[ RUN      ] LazyTest.testCollectAllWithAllocator
[       OK ] LazyTest.testCollectAllWithAllocator (6 ms)
[ RUN      ] LazyTest.testCollectAllVariadic
[       OK ] LazyTest.testCollectAllVariadic (9 ms)
[ RUN      ] LazyTest.testCollectAny
[       OK ] LazyTest.testCollectAny (134 ms)
[ RUN      ] LazyTest.testCollectAnyVariadic
[       OK ] LazyTest.testCollectAnyVariadic (138 ms)
[ RUN      ] LazyTest.testException
[       OK ] LazyTest.testException (1 ms)
[ RUN      ] LazyTest.testContext
[       OK ] LazyTest.testContext (6 ms)
[ RUN      ] LazyTest.testDestroyOrder
0
[       OK ] LazyTest.testDestroyOrder (1 ms)
[ RUN      ] LazyTest.testLazyPerf
             lazy 30 loop call: 64888 ns
            lazy 30 chain call: 71491 ns
[       OK ] LazyTest.testLazyPerf (683 ms)
[ RUN      ] LazyTest.testcollectAllParallel
28872
36460
23652
36728
15176
23652
44044
44044
[       OK ] LazyTest.testcollectAllParallel (30 ms)
[ RUN      ] LazyTest.testBatchedcollectAll
input tasks maybe run not in different thread, thread id:
35208
25304
35208
25304
35208
25304
35208
expect[0]: 1, result[0]: 1
expect[1]: 5, result[1]: 5
expect[2]: 2, result[2]: 2
expect[3]: 6, result[3]: 6
expect[4]: 3, result[4]: 3
expect[5]: 7, result[5]: 7
expect[6]: 4, result[6]: 4
expect[7]: 8, result[7]: 8
[       OK ] LazyTest.testBatchedcollectAll (578 ms)
[ RUN      ] LazyTest.testDetach
[       OK ] LazyTest.testDetach (0 ms)
[----------] 23 tests from LazyTest (130934 ms total)

[----------] 2 tests from MutexTest
[ RUN      ] MutexTest.testLock
[       OK ] MutexTest.testLock (1 ms)
[ RUN      ] MutexTest.testAsyncLock
[       OK ] MutexTest.testAsyncLock (4054 ms)
[----------] 2 tests from MutexTest (4056 ms total)

[----------] 1 test from SleepTest
[ RUN      ] SleepTest.testSleep
1011
905
36624
36624
905
[       OK ] SleepTest.testSleep (2827 ms)
[----------] 1 test from SleepTest (2828 ms total)

[----------] 3 tests from SpinLockTest
[ RUN      ] SpinLockTest.testLockImmediately
[       OK ] SpinLockTest.testLockImmediately (0 ms)
[ RUN      ] SpinLockTest.testLockYield
[       OK ] SpinLockTest.testLockYield (11 ms)
[ RUN      ] SpinLockTest.testSyncLock
[       OK ] SpinLockTest.testSyncLock (57 ms)
[----------] 3 tests from SpinLockTest (72 ms total)

[----------] 2 tests from TraitsTest
[ RUN      ] TraitsTest.testHasCoAwaitMethod
[       OK ] TraitsTest.testHasCoAwaitMethod (0 ms)
[ RUN      ] TraitsTest.testHasCoAwaitOperator
[       OK ] TraitsTest.testHasCoAwaitOperator (0 ms)
[----------] 2 tests from TraitsTest (1 ms total)

[----------] 1 test from ViaCoroutineTest
[ RUN      ] ViaCoroutineTest.SimplecheckoutEQcheckin
[       OK ] ViaCoroutineTest.SimplecheckoutEQcheckin (2 ms)
[----------] 1 test from ViaCoroutineTest (2 ms total)

[----------] Global test environment tear-down
[==========] 37 tests from 8 test suites ran. (138962 ms total)
[  PASSED  ] 37 tests.

Reproduction way

"C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvars64.bat" cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release set CL=/bigobj /fsanitize=address -D_WIN32_WINNT=0x0A00 /Zi //with asan set CL=/bigobj -D_WIN32_WINNT=0x0A00 //without asan ninja

Anything else

async_simple trunk vs 2022 latest preview

C:\Github\async_simple\build>cl -v
Microsoft (R) C/C++ Optimizing Compiler Version 19.35.32019 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

Are you willing to submit a PR?

  • [ ] Yes I am willing to submit a PR!

meongmeongasd avatar Nov 29 '22 06:11 meongmeongasd

The scale of Release will be much bigger than the Debug version. So it may not surprised that the execution time of Debug is less than Release

ChuanqiXu9 avatar Nov 29 '22 07:11 ChuanqiXu9