MCPcopy Create free account
hub / github.com/catboost/catboost / DoSkip

Method DoSkip

util/stream/file.cpp:33–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33size_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
52TUnbufferedFileOutput::TUnbufferedFileOutput(const char* path)
53 : TUnbufferedFileOutput(TFile(path, OPEN_MODE))

Callers

nothing calls this directly

Calls 3

GetLengthMethod · 0.45
GetPositionMethod · 0.45
SeekMethod · 0.45

Tested by

no test coverage detected