Creates an AtomicBatchDispatcher that uses the given dispatch function.
Synopsis
Declared in <folly/fibers/AtomicBatchDispatcher.h>
template<
typename InputT,
typename ResultT>
AtomicBatchDispatcher<InputT, ResultT>
createAtomicBatchDispatcher(
folly::Function<std::vector<ResultT>(std::vector<InputT>&&)> dispatchFunc,
size_t initialCapacity = 0);
Description
initialCapacity is a hint about the number of inputs to expect:
-
It is used purely to reserve space for storing vector of inputs etc., so that reeallocation and move copy are reduced / not needed.
-
It is provided purely for performance reasons
Return Value
A new AtomicBatchDispatcher using dispatchFunc.
Parameters
Name |
Description |
dispatchFunc |
The function that processes the batch of inputs. |
initialCapacity |
Hint for the number of inputs to reserve space for. |
Created with MrDocs