Ecosyste.ms: Packages

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

Top 8.2% on proxy.golang.org

proxy.golang.org : github.com/IBM/fast-fan-in

Package fan is a type-flexible fan-in pattern implementation This package provides convenient and efficient mechanisms for combining many channels with the same element type into one channel with that element type. For any primitive type in Go, this package provides helper methods to "fan-in" many channels with that primitive as the element type. For instance, if you have several channels of integers: For non-primitive types, you can achieve good performance by providing an anonymous function that type-asserts the channels to the appropriate element type (avoiding reflection on the hot path): This small bit of boilerplate captures the necessary type information to avoid performing any reflection while passing data read from the channels, resulting in the same throughput as a custom implementation for your type. All SelectFunc implementations look essentially the same, with the only difference being the element type of the channels in the two type assertions. If your use-case is not performance-critical, we also provide a reflection-based fallback implementation which is used when no SelectFunc is provided. See [benchmarks](#benchmarks) to understand the performance effect of this implementation. To use the inefficient reflection-based approach on a custom type, you can do:

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/%21i%21b%21m/fast-fan-in
Keywords: channels, concurrency, fan-in, go
License: Apache-2.0
Latest release: about 4 years ago
First release: about 4 years ago
Namespace: github.com/IBM
Stars: 25 on GitHub
Forks: 7 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 29 days ago

    Loading...
    Readme
    Loading...