Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 2.1% on proxy.golang.org
Top 0.1% dependent packages on proxy.golang.org
Top 0.1% dependent repos on proxy.golang.org
Top 5.1% forks on proxy.golang.org
Top 0.1% docker downloads on proxy.golang.org

proxy.golang.org : github.com/philhofer/fwd

Package fwd provides a buffered reader and writer. Each has methods that help improve the encoding/decoding performance of some binary protocols. The Writer and Reader type provide similar functionality to their counterparts in bufio, plus a few extra utility methods that simplify read-ahead and write-ahead. I wrote this package to improve serialization performance for http://github.com/tinylib/msgp, where it provided about a 2x speedup over `bufio` for certain workloads. However, care must be taken to understand the semantics of the extra methods provided by this package, as they allow the user to access and manipulate the buffer memory directly. The extra methods for Reader are Reader.Peek, Reader.Skip and Reader.Next. (*fwd.Reader).Peek, unlike (*bufio.Reader).Peek, will re-allocate the read buffer in order to accommodate arbitrarily large read-ahead. (*fwd.Reader).Skip skips the next 'n' bytes in the stream, and uses the io.Seeker interface if the underlying stream implements it. (*fwd.Reader).Next returns a slice pointing to the next 'n' bytes in the read buffer (like Reader.Peek), but also increments the read position. This allows users to process streams in arbitrary block sizes without having to manage appropriately-sized slices. Additionally, obviating the need to copy the data from the buffer to another location in memory can improve performance dramatically in CPU-bound applications. Writer only has one extra method, which is (*fwd.Writer).Next, which returns a slice pointing to the next 'n' bytes of the writer, and increments the write position by the length of the returned slice. This allows users to write directly to the end of the buffer.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/philhofer/fwd
License: MIT
Latest release: over 1 year ago
First release: over 6 years ago
Namespace: github.com/philhofer
Dependent packages: 3,426
Dependent repositories: 12,369
Stars: 64 on GitHub
Forks: 19 on GitHub
Docker dependents: 2,026
Docker downloads: 12,503,165,881
See more repository details: repos.ecosyste.ms
Last synced: 5 days ago

    Loading...
    Readme
    Loading...