1 // ==++==
2 //
3 //   Copyright (c) Microsoft Corporation.  All rights reserved.
4 //
5 // ==--==
6 // =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
7 //
8 // ParallelMergeOptions.cs
9 //
10 // <OWNER>igoro</OWNER>
11 //
12 // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
13 
14 namespace System.Linq
15 {
16     /// <summary>
17     /// Specifies the preferred type of output merge to use in a query. This is a hint only, and may not be
18     /// respected by the system when parallelizing all queries.
19     /// </summary>
20     /// <remarks>
21     /// <para>
22     /// Use <b>NotBuffered</b> for queries that will be consumed and output as streams, this has the lowest latency
23     /// between beginning query execution and elements being yielded. For some queries, such as those involving a
24     /// sort (OrderBy, OrderByDescending), buffering is essential and a hint of NotBuffered or AutoBuffered will
25     /// be ignored.
26     /// </para>
27     /// <para>
28     /// Use <b>AutoBuffered</b> for most cases; this is the default.  It strikes a balance between latency and
29     /// overall performance.
30     /// </para>
31     /// <para>
32     /// Use <b>FullyBuffered</b> for queries when the entire output can be processed before the information is
33     /// needed. This option offers the best performance when all of the output can be accumulated before yielding
34     /// any information, though it is not suitable for stream processing or showing partial results mid-query.
35     /// </para>
36     /// </remarks>
37     public enum ParallelMergeOptions
38     {
39         /// <summary>
40         /// Use the default merge type, which is AutoBuffered.
41         /// </summary>
42         Default = 0,
43 
44         /// <summary>
45         /// Use a merge without output buffers. As soon as result elements have been computed,
46         /// make that element available to the consumer of the query.
47         /// </summary>
48         NotBuffered = 1,
49 
50         /// <summary>
51         /// Use a merge with output buffers of a size chosen by the system. Results
52         /// will accumulate into an output buffer before they are available to the consumer of
53         /// the query.
54         /// </summary>
55         AutoBuffered = 2,
56 
57         /// <summary>
58         /// Use a merge with full output buffers. The system will accumulate all of the
59         /// results before making any of them available to the consumer of the query.
60         /// </summary>
61         FullyBuffered = 3
62     }
63 }