http://bugs.winehq.org/show_bug.cgi?id=21245
--- Comment #9 from denis bonnenfant denis.bonnenfant@diderot.org 2010-07-07 05:10:40 --- I investigated the problem a little bit further and found that the function SmallBlockChainStream_GetNextBlockInChain called in the first loop in SmallBlockChainStream_WriteAt is responsive : it calls BlockChainStream_ReadAt for reading 4 bytes (Sizeof(DWORD)) at a time, so it is particularly unefficient...
trace:storage:SmallBlockChainStream_WriteAt + trace:storage:SmallBlockChainStream_GetNextBlockInChain --------- trace:storage:BlockChainStream_ReadAt (0x116a2290)-> 7932 0x32d54c 4 0x32d548 trace:storage:BlockChainStream_ReadAt block 2545 trace:storage:ImplBIGBLOCKFILE_ReadAt (0x116a2210)-> 1303804 0x32d54c 4 0x32d4e8 trace:storage:ImplBIGBLOCKFILE_ReadAt page 1, offset 255228, bytes_from_page 4, bytes_left 4 trace:storage:ImplBIGBLOCKFILE_ReadAt finished trace:storage:SmallBlockChainStream_WriteAt + trace:storage:SmallBlockChainStream_GetNextBlockInChain --------- trace:storage:BlockChainStream_ReadAt (0x116a2290)-> 7936 0x32d54c 4 0x32d548 trace:storage:BlockChainStream_ReadAt block 2545 trace:storage:ImplBIGBLOCKFILE_ReadAt (0x116a2210)-> 1303808 0x32d54c 4 0x32d4e8 trace:storage:ImplBIGBLOCKFILE_ReadAt page 1, offset 255232, bytes_from_page 4, bytes_left 4 trace:storage:ImplBIGBLOCKFILE_ReadAt finished
while ( (blockNoInSequence > 0) && (blockIndex != BLOCK_END_OF_CHAIN)) { if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, &blockIndex))) return STG_E_DOCFILECORRUPT; blockNoInSequence--; }
As this loop seems to be here just to verify data integrity, removing it is harmful, and made huge speed improvement !