| 31 | } |
| 32 | |
| 33 | size_t TUnbufferedFileInput::DoSkip(size_t len) { |
| 34 | if (len < 384) { |
| 35 | /* Base implementation calls DoRead, which results in one system call |
| 36 | * instead of three as in fair skip implementation. For small sizes |
| 37 | * actually doing one read is cheaper. Experiments show that the |
| 38 | * border that separates two implementations performance-wise lies |
| 39 | * in the range of 384-512 bytes (assuming that the file is in OS cache). */ |
| 40 | return IInputStream::DoSkip(len); |
| 41 | } |
| 42 | |
| 43 | /* TFile::Seek can seek beyond the end of file, so we need to do |
| 44 | * size check here. */ |
| 45 | i64 size = File_.GetLength(); |
| 46 | i64 oldPos = File_.GetPosition(); |
| 47 | i64 newPos = File_.Seek(Min<i64>(size, oldPos + len), sSet); |
| 48 | |
| 49 | return newPos - oldPos; |
| 50 | } |
| 51 | |
| 52 | TUnbufferedFileOutput::TUnbufferedFileOutput(const char* path) |
| 53 | : TUnbufferedFileOutput(TFile(path, OPEN_MODE)) |
nothing calls this directly
no test coverage detected