As noted in 4170047, the best answer here is most likely to design a new and cleaner random-access stream abstraction. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links.We can manipulate the File Pointer to point anywhere within our file.
Before reading this tutorial be sure to check the Random Access File API.
Before jumping with both feet, and replacing our journaller implementation, I thought I would try to isolate the change with a small benchmark that performs a similar workload to our exchange, with the ability to swap out the implementation of the write call. Since this is a micro-benchmark, I wanted to test just the code path, separated from the underlying storage medium.
If there is a significant difference, then this is something to try on a real file-system, under real load.
This is NOT a very heavy price to pay for performance gains of up to 800% !!
For example read Short() changes from public short read Short() Add an object instance variable: private byte tmp Buf = new byte; public short read Short() Similar changes can be made to all the multi-byte read and write methods.