-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Player has three potential bottlenecks; checksum generation, deserialization and splicing. Checksum generation and testing is something that we do that others might not do, so we are going to pay a price for those checksums in the shootouts. Checksums require slices. Maybe it is faster if you use a JavaScript checksum modified to work with buffers and ranges. If it comes down to all benchmarks all the time, then we're going to want to turn them off in Locket, or else wait until they save someone's bacon.
Deserialization might be improved by using a binary file format. Maybe it is enough to can for the end of the header array explicitly. Maybe it is important to go binary. You could create a translator that would read a binary file format and emit your pretty text format. Binary means you could use a Packet compiler and have a best-foot forward reader. It would be easier to checksum without having to read into buffers.
You might want to consider making record serialization pluggable.
I'm concerned that the Magazine lookup on each splice is costing too much. The Cartridge could be stored in the page, so adjusting heft could be done without the lookup.
Reading the buffer from file seems to happen quickly enough and there is little that I can do to make Node.js load a file faster. All performance must be squeezed from the synchronous buffer reading loop.