tracing updated
This commit is contained in:
		
							parent
							
								
									96338b559e
								
							
						
					
					
						commit
						30284c8f72
					
				
							
								
								
									
										8
									
								
								faq.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								faq.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | ### Why is `Coroutine[Any, Any, T]` used instead of `Awaitable[T]`? | ||||||
|  | * Typing issues (PyCharm) | ||||||
|  | * Explicit expression of whether some sort of action is performed or not (tasks vs futures vs coros) | ||||||
|  | 
 | ||||||
|  | ### Why is `subset-verify-optimized` branch closed? | ||||||
|  | * Performance gain at large set sizes are 0% or less. | ||||||
|  | * Performance gain with caching is always negative. | ||||||
|  | * Using merge-based optimization is assumed to be even less practical. | ||||||
| @ -110,18 +110,20 @@ class TestBridge(unittest.IsolatedAsyncioTestCase): | |||||||
| 
 | 
 | ||||||
|     async def test_flowstandard(self): |     async def test_flowstandard(self): | ||||||
|         set_gather_linear() |         set_gather_linear() | ||||||
|         set0 = {os.urandom(8).hex().encode() for _ in range(64)} |         set0 = {os.urandom(8).hex().encode() for _ in range(512)} | ||||||
|         abt0: ActiveBinaryTree[Plain, Integer] = await self.abt_of(*set0) |         abt0: ActiveBinaryTree[Plain, Integer] = await self.abt_of(*set0) | ||||||
|         abt1: ActiveBinaryTree[Plain, Integer] = abt0 |         abt1: ActiveBinaryTree[Plain, Integer] = abt0 | ||||||
|         for _ in range(16): |         for _ in range(32): | ||||||
|             abt1 = await abt1.add(HashPoint.of(Plain(os.urandom(8).hex().encode()))) |             abt1 = await abt1.add(HashPoint.of(Plain(os.urandom(8).hex().encode()))) | ||||||
|         fs0 = FlowStandard(abt0.protocolized()) |         fs0 = FlowStandard(abt0.protocolized()) | ||||||
|         fs1 = FlowStandard(abt1.protocolized()) |         fs1 = FlowStandard(abt1.protocolized()) | ||||||
|         _t = time.process_time() |         _t = time.process_time() | ||||||
|         await fs0.verify_subset(UnitReducer(fs1)) |         for _ in range(16): | ||||||
|  |             await fs0.verify_subset(UnitReducer(fs1)) | ||||||
|         with self.assertWarns(RuntimeWarning): |         with self.assertWarns(RuntimeWarning): | ||||||
|             with self.assertRaises(ValueError): |             for _ in range(16): | ||||||
|                 await fs1.verify_subset(UnitReducer(fs0)) |                 with self.assertRaises(ValueError): | ||||||
|  |                     await fs1.verify_subset(UnitReducer(fs0)) | ||||||
|         print('verification time', time.process_time() - _t) |         print('verification time', time.process_time() - _t) | ||||||
| 
 | 
 | ||||||
|     async def test_flow13(self): |     async def test_flow13(self): | ||||||
|  | |||||||
| @ -75,14 +75,9 @@ async def _instrument(process: Callable[[], Coroutine[Any, Any, None]]) -> list[ | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| async def _process(bank: BankBlock) -> None: | async def _process(bank: BankBlock) -> None: | ||||||
|     assert_true(await bank.verify()) |  | ||||||
|     print('processed') |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| async def _pre_measure(bank: BankBlock): |  | ||||||
|     with Measure(bank, 'verify') as measurement: |     with Measure(bank, 'verify') as measurement: | ||||||
|         await _process(bank) |         assert_true(await bank.verify()) | ||||||
|     print('pre-measured', *(f'{t:.3f}' for t in measurement.log)) |     print('measured', *(f'{t:.3f}' for t in measurement.log)) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| async def _trace(params): | async def _trace(params): | ||||||
| @ -92,7 +87,7 @@ async def _trace(params): | |||||||
|         *params['subjects'], |         *params['subjects'], | ||||||
|         *params['transactions'], |         *params['transactions'], | ||||||
|     ) |     ) | ||||||
|     await _pre_measure(bank) |     await _process(bank) | ||||||
|     bank = await _migrate(bank, params) |     bank = await _migrate(bank, params) | ||||||
|     set_gather_asyncio() |     set_gather_asyncio() | ||||||
|     with DeintrumentationSize(Instrumentation, 'deinstrument'): |     with DeintrumentationSize(Instrumentation, 'deinstrument'): | ||||||
| @ -120,6 +115,6 @@ preset_old = dict(blocks=16, subjects=(8, 15), transactions=(8, 15), caching=Fal | |||||||
| if __name__ == '__main__': | if __name__ == '__main__': | ||||||
|     asyncio.run( |     asyncio.run( | ||||||
|         trace( |         trace( | ||||||
|             preset_short |             preset_long | ||||||
|         ) |         ) | ||||||
|     ) |     ) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user