[英]File Stream : Elixir
I often see in Elixir forums:我经常在 Elixir 论坛上看到:
"path/to/file"
|> File.stream!(read_ahead: 100_000)
What does read_ahead: 100_000 mean? read_ahead: 100_000是什么意思?
It is one of stream_mode 's.它是stream_mode之一。 It's meaning is described in erlang documentation:
erlang文档中描述了它的含义:
{read_ahead, Size}
Activates read data buffering.{read_ahead, Size}
激活读取数据缓冲。 If read/2 calls are for significantly less than Size bytes, read operations to the operating system are still performed for blocks of Size bytes.如果 read/2 调用明显小于 Size 字节,则仍对 Size 字节块执行对操作系统的读取操作。 The extra data is buffered and returned in subsequent read/2 calls, giving a performance gain as the number of operating system calls is reduced.
额外的数据被缓冲并在随后的 read/2 调用中返回,从而随着操作系统调用数量的减少而提高性能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.