@@ -12,18 +12,31 @@ import scala.concurrent.duration.Duration
1212
1313private object StreamingRestApi {
1414 trait RestTestApi {
15- @ GET def simpleNumbers (size : Int ): Observable [Int ]
16- @ GET def simpleNumbersWithoutStreaming (size : Int ): Task [List [Int ]]
15+ @ GET def exampleEndpoint (size : Int ): Observable [RestExampleData ]
16+
17+ @ streamingResponseBatchSize(10 )
18+ @ GET def exampleEndpointBatch10 (size : Int ): Observable [RestExampleData ]
19+
20+ @ streamingResponseBatchSize(500 )
21+ @ GET def exampleEndpointBatch500 (size : Int ): Observable [RestExampleData ]
22+
23+ @ GET def exampleEndpointWithoutStreaming (size : Int ): Task [List [RestExampleData ]]
1724 }
1825
1926 object RestTestApi extends DefaultRestApiCompanion [RestTestApi ] {
2027 final class Impl extends RestTestApi {
2128
22- def simpleNumbers (size : Int ): Observable [Int ] =
23- Observable .fromIterable( Range ( 0 , size) )
29+ def exampleEndpoint (size : Int ): Observable [RestExampleData ] =
30+ RestExampleData .generateRandomObservable( size)
2431
25- def simpleNumbersWithoutStreaming (size : Int ): Task [List [Int ]] =
26- Task .eval(Range (0 , size).toList)
32+ def exampleEndpointBatch10 (size : Int ): Observable [RestExampleData ] =
33+ RestExampleData .generateRandomObservable(size)
34+
35+ def exampleEndpointBatch500 (size : Int ): Observable [RestExampleData ] =
36+ RestExampleData .generateRandomObservable(size)
37+
38+ def exampleEndpointWithoutStreaming (size : Int ): Task [List [RestExampleData ]] =
39+ RestExampleData .generateRandomList(size)
2740 }
2841 }
2942
@@ -51,41 +64,71 @@ class StreamingRestApi {
5164
5265
5366 @ Benchmark
54- def smallNumbersArray (): Unit = {
67+ def smallArray (): Unit = {
5568 waitStreamingEndpoint(10 )
5669 }
5770
5871 @ Benchmark
59- def mediumNumbersArray (): Unit = {
72+ def mediumArray (): Unit = {
6073 waitStreamingEndpoint(200 )
6174 }
6275
6376 @ Benchmark
64- def hugeNumbersArray (): Unit = {
77+ def hugeArray (): Unit = {
6578 waitStreamingEndpoint(5000 )
6679 }
6780
6881 @ Benchmark
69- def smallNumbersArrayWithoutStreaming (): Unit = {
82+ def smallArrayBatch10 (): Unit = {
83+ wait(this .proxy.exampleEndpointBatch10(10 ).toListL)
84+ }
85+
86+ @ Benchmark
87+ def mediumArrayBatch10 (): Unit = {
88+ wait(this .proxy.exampleEndpointBatch10(200 ).toListL)
89+ }
90+
91+ @ Benchmark
92+ def hugeArrayBatch10 (): Unit = {
93+ wait(this .proxy.exampleEndpointBatch10(5000 ).toListL)
94+ }
95+
96+ @ Benchmark
97+ def smallArrayBatch500 (): Unit = {
98+ wait(this .proxy.exampleEndpointBatch500(10 ).toListL)
99+ }
100+
101+ @ Benchmark
102+ def mediumArrayBatch500 (): Unit = {
103+ wait(this .proxy.exampleEndpointBatch500(200 ).toListL)
104+ }
105+
106+ @ Benchmark
107+ def hugeArrayBatch500 (): Unit = {
108+ wait(this .proxy.exampleEndpointBatch500(5000 ).toListL)
109+ }
110+
111+ @ Benchmark
112+ def smallArrayWithoutStreaming (): Unit = {
70113 waitEndpointWithoutStreaming(10 )
71114 }
72115
73116 @ Benchmark
74- def mediumNumbersArrayWithoutStreaming (): Unit = {
117+ def mediumArrayWithoutStreaming (): Unit = {
75118 waitEndpointWithoutStreaming(200 )
76119 }
77120
78121 @ Benchmark
79- def hugeNumbersArrayWithoutStreaming (): Unit = {
122+ def hugeArrayWithoutStreaming (): Unit = {
80123 waitEndpointWithoutStreaming(5000 )
81124 }
82125
83126 private def waitEndpointWithoutStreaming (samples : Int ): Unit = {
84- wait(this .proxy.simpleNumbersWithoutStreaming (samples))
127+ wait(this .proxy.exampleEndpointWithoutStreaming (samples))
85128 }
86129
87130 private def waitStreamingEndpoint (samples : Int ): Unit = {
88- wait(this .proxy.simpleNumbers (samples).toListL)
131+ wait(this .proxy.exampleEndpoint (samples).toListL)
89132 }
90133
91134 private def wait [T ](task : Task [List [T ]]): Unit = {
0 commit comments