Serializer is not using 100% CPU
Currently I'm running a few simple serialization tests. A few thousand objects are serilaized and deserialized within a loop. I noticed that this test is not using 100% cpu. Could anyone explain why?
UPDATE
I'm serializing into memory, and serial开发者_开发技巧ization is singlethreaded. I'm using standard .NET binary serialization and protobuf-net to compare.
IO Operations make the thread running the serialization to block.
While it is blocked, other processes might get CPU time.
Have you got a multi-core processor? Because, if so, serialization will only use one of the cores because it's a single threaded process.
Perhaps you have a multicore CPU and the serialization code is single-threaded?
- Multi core / thread CPU?
- Memory speed overhead?
- Disk speed overhead?
CPU's are faster as:
- Disk (even SSD)
- Network
- RAM / Memory
If you are allocating thousands of objects, you might be waiting for some page-faults.
If you are doing a de-serialization multithreaded, there might be some locking issues.
精彩评论