Modify

Opened 3 years ago

Last modified 8 months ago

#13275 new enhancement

[Patch] Use parallel stream for StyledMapRenderer, MultipolygonBuilder?

Reported by: simon04 Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: java8, multipolygon Cc: michael2402

Description

The the parallelized code in StyledMapRenderer, MultipolygonBuilder can be simplified using Java 8's parallel streams.

Attachments (4)

13275.patch (18.6 KB) - added by simon04 3 years ago.
cache_Area_intersection_v2.patch (24.2 KB) - added by GerdP 3 years ago.
includes 13275.patch
cache_Area_intersection_v1.patch (9.9 KB) - added by GerdP 3 years ago.
cache results from Area intersection tests
patch-13275-parallel-draw.patch (21.6 KB) - added by michael2402 3 years ago.

Download all attachments as: .zip

Change History (27)

Changed 3 years ago by simon04

Attachment: 13275.patch added

comment:1 Changed 3 years ago by simon04

Owner: changed from team to simon04
Status: newassigned

comment:2 Changed 3 years ago by simon04

Type: defectenhancement

comment:3 Changed 3 years ago by GerdP

I noticed that MultipolygonBuilder is doing a lot of costly Geometry.polygonIntersection() tests
to find out which polygons are inside/outside. Many of these tests can be omitted and thus complex
polygons could be processed much faster. Example: A (outer) polygon o with three inner ways a, b, c.
When the result of Geometry.polygonIntersection(a,b) is OUTSIDE, the result of Geometry.polygonIntersection(b,a)
will also be OUTSIDE, so there is no need to do this calculation, but it is done.
I am working on a patch that stores the results so that the repeated calculations are avoided.

comment:4 Changed 3 years ago by bastiK

Cc: michael2402 added

Interesting stuff! I see an performance improvement for rendering phase 1. It's hard to measure because of the fluctuations, but could be about 15 %. (Intel i7, 4x2 cores)

Changed 3 years ago by GerdP

includes 13275.patch

Changed 3 years ago by GerdP

cache results from Area intersection tests

comment:5 Changed 3 years ago by GerdP

I've created two patches to show my idea.
cache_Area_intersection_v1.patch : based on 10743
cache_Area_intersection_v2.patch : based on 10743 + 13275.patch

With complex polygons I see
DEBUG: Test 'Multipolygon' completed in 53.5 s
without the patch and with the patch v2:
DEBUG: mp cache: Tests: 6 hit/miss 3/3
DEBUG: mp cache: Tests: 4 hit/miss 2/2
DEBUG: mp cache: Tests: 1888 hit/miss 1125/763
DEBUG: mp cache: Tests: 4 hit/miss 2/2
DEBUG: Test 'Multipolygon' completed in 42.6 s

I am not an expert reg. multi-threading, so I consider this as a proof of concept.

comment:6 Changed 3 years ago by michael2402

For the test area I used, I saw a decrease in performance (Krarlsruhe, 48.9819932..48.999449, 8.3939586..8.4182991, Potlatch style)

OLD:

BENCHMARK: rendering phase 1 (calculate styles): 813 ms; phase 2 (draw): 837 ms; total: 1,6 s (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 65 ms; phase 2 (draw): 344 ms; total: 385 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 49 ms; phase 2 (draw): 353 ms; total: 372 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 31 ms; phase 2 (draw): 289 ms; total: 309 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 26 ms; phase 2 (draw): 296 ms; total: 309 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 22 ms; phase 2 (draw): 324 ms; total: 335 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 23 ms; phase 2 (draw): 282 ms; total: 291 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 31 ms; phase 2 (draw): 278 ms; total: 297 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 18 ms; phase 2 (draw): 294 ms; total: 301 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 15 ms; phase 2 (draw): 142 ms; total: 148 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 22 ms; phase 2 (draw): 312 ms; total: 321 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 17 ms; phase 2 (draw): 282 ms; total: 289 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 19 ms; phase 2 (draw): 263 ms; total: 271 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 282 ms; total: 290 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 23 ms; phase 2 (draw): 304 ms; total: 311 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 15 ms; phase 2 (draw): 263 ms; total: 269 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 24 ms; phase 2 (draw): 291 ms; total: 298 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 17 ms; phase 2 (draw): 263 ms; total: 270 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 30 ms; phase 2 (draw): 273 ms; total: 291 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 17 ms; phase 2 (draw): 262 ms; total: 269 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 17 ms; phase 2 (draw): 272 ms; total: 279 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 27 ms; phase 2 (draw): 284 ms; total: 291 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 17 ms; phase 2 (draw): 271 ms; total: 278 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 17 ms; phase 2 (draw): 287 ms; total: 294 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 16 ms; phase 2 (draw): 275 ms; total: 281 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 16 ms; phase 2 (draw): 274 ms; total: 280 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 16 ms; phase 2 (draw): 271 ms; total: 278 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 16 ms; phase 2 (draw): 275 ms; total: 282 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 17 ms; phase 2 (draw): 270 ms; total: 277 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 17 ms; phase 2 (draw): 282 ms; total: 289 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 16 ms; phase 2 (draw): 273 ms; total: 280 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 18 ms; phase 2 (draw): 283 ms; total: 290 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 16 ms; phase 2 (draw): 271 ms; total: 278 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 16 ms; phase 2 (draw): 262 ms; total: 268 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 31 ms; phase 2 (draw): 275 ms; total: 294 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 17 ms; phase 2 (draw): 259 ms; total: 267 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 16 ms; phase 2 (draw): 285 ms; total: 292 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 16 ms; phase 2 (draw): 260 ms; total: 267 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 16 ms; phase 2 (draw): 286 ms; total: 292 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 17 ms; phase 2 (draw): 259 ms; total: 267 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 17 ms; phase 2 (draw): 284 ms; total: 291 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 267 ms; total: 274 ms (scale: 206.5005879032801 zoom level: 16)

NEW:

BENCHMARK: rendering phase 1 (calculate styles): 807 ms; phase 2 (draw): 879 ms; total: 1,7 s (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 94 ms; phase 2 (draw): 354 ms; total: 448 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 64 ms; phase 2 (draw): 303 ms; total: 367 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 44 ms; phase 2 (draw): 293 ms; total: 337 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 45 ms; phase 2 (draw): 282 ms; total: 327 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 36 ms; phase 2 (draw): 276 ms; total: 312 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 41 ms; phase 2 (draw): 274 ms; total: 315 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 23 ms; phase 2 (draw): 297 ms; total: 320 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 22 ms; phase 2 (draw): 295 ms; total: 317 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 291 ms; total: 312 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 23 ms; phase 2 (draw): 273 ms; total: 296 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 30 ms; phase 2 (draw): 268 ms; total: 298 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 23 ms; phase 2 (draw): 276 ms; total: 299 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 28 ms; phase 2 (draw): 286 ms; total: 314 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 266 ms; total: 287 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 35 ms; phase 2 (draw): 270 ms; total: 305 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 25 ms; phase 2 (draw): 284 ms; total: 309 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 22 ms; phase 2 (draw): 277 ms; total: 299 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 273 ms; total: 294 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 28 ms; phase 2 (draw): 267 ms; total: 295 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 283 ms; total: 304 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 257 ms; total: 278 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 36 ms; phase 2 (draw): 266 ms; total: 302 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 281 ms; total: 302 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 23 ms; phase 2 (draw): 258 ms; total: 281 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 20 ms; phase 2 (draw): 267 ms; total: 287 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 34 ms; phase 2 (draw): 279 ms; total: 313 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 286 ms; total: 307 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 258 ms; total: 279 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 278 ms; total: 299 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 20 ms; phase 2 (draw): 273 ms; total: 293 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 270 ms; total: 291 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 20 ms; phase 2 (draw): 274 ms; total: 294 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 263 ms; total: 284 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 22 ms; phase 2 (draw): 270 ms; total: 292 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 285 ms; total: 306 ms (scale: 206.5005879032801 zoom level: 16)
BENCHMARK: rendering phase 1 (calculate styles): 21 ms; phase 2 (draw): 270 ms; total: 291 ms (scale: 206.5005879032801 zoom level: 16)

I did some analysis on this several months ago and got the same result: Streams are faster in some complex situations but for basic styles, the extra work required for boxing everything into a stream object does not pay of.

But it makes the code much nicer to read ;-)

BTW: I played around a bit with parallel drawing. This is what I found:

  • Using a simple .parallelStream().collect(new Graphics, paint the element, combine graphics) has horrible performance.
  • Splitting the style elements in chunks should not be done evenly. The first ones to draw are the most expensive ones (areas).
  • merging two graphics is pretty expensive
  • you use up a lot of extra memory.

This are the results using 4 cores:

BENCHMARK: rendering phase 1 (calculate styles): 637 ms; phase 2 (draw): 517 ms; total: 1,2 s (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 85 ms; phase 2 (draw): 210 ms; total: 295 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 65 ms; phase 2 (draw): 182 ms; total: 247 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 57 ms; phase 2 (draw): 157 ms; total: 214 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 27 ms; phase 2 (draw): 145 ms; total: 172 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 25 ms; phase 2 (draw): 148 ms; total: 173 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 30 ms; phase 2 (draw): 149 ms; total: 179 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 29 ms; phase 2 (draw): 146 ms; total: 175 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 28 ms; phase 2 (draw): 130 ms; total: 158 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 35 ms; phase 2 (draw): 131 ms; total: 166 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 27 ms; phase 2 (draw): 127 ms; total: 154 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 38 ms; phase 2 (draw): 131 ms; total: 169 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 22 ms; phase 2 (draw): 137 ms; total: 159 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 22 ms; phase 2 (draw): 282 ms; total: 304 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 25 ms; phase 2 (draw): 144 ms; total: 169 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 23 ms; phase 2 (draw): 126 ms; total: 149 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 22 ms; phase 2 (draw): 122 ms; total: 144 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 22 ms; phase 2 (draw): 116 ms; total: 138 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 34 ms; phase 2 (draw): 123 ms; total: 157 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 28 ms; phase 2 (draw): 120 ms; total: 148 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 31 ms; phase 2 (draw): 129 ms; total: 160 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 37 ms; phase 2 (draw): 119 ms; total: 156 ms (scale: 242.89089332231515 zoom level: 15)
BENCHMARK: rendering phase 1 (calculate styles): 27 ms; phase 2 (draw): 117 ms; total: 144 ms (scale: 242.89089332231515 zoom level: 15)

There are some more optimizations I can think of:

  • Make Style sorting a lot faster by giving each style a sorting index (long). I used a similar method for the OpenGL rendering
  • Make search nodes/ways/relations parallel
  • Create a new QuadBucket search method that returns a spliterator. That way we do not need the intermediate list.
Last edited 3 years ago by michael2402 (previous) (diff)

Changed 3 years ago by michael2402

comment:7 Changed 3 years ago by bastiK

@Gerd Petermann: Could you please open a new ticket for your work on the multipolygons?

comment:8 Changed 3 years ago by bastiK

Here are my results:
OLD:

BENCHMARK: rendering phase 1 (calculate styles): 2.5 s; phase 2 (draw): 6.1 s; total: 8.4 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 798 ms; phase 2 (draw): 1.1 s; total: 1.8 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 704 ms; phase 2 (draw): 4.3 s; total: 4.9 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 760 ms; phase 2 (draw): 4.6 s; total: 5.3 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 793 ms; phase 2 (draw): 4.3 s; total: 5.1 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 738 ms; phase 2 (draw): 4.3 s; total: 5.0 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 729 ms; phase 2 (draw): 4.6 s; total: 5.3 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 731 ms; phase 2 (draw): 4.3 s; total: 4.9 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 742 ms; phase 2 (draw): 4.5 s; total: 5.2 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 777 ms; phase 2 (draw): 4.3 s; total: 5.0 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 677 ms; phase 2 (draw): 4.7 s; total: 5.3 s (scale: 1088.6692085678621 zoom level: 13)

NEW:

BENCHMARK: rendering phase 1 (calculate styles): 3.5 s; phase 2 (draw): 5.7 s; total: 9.2 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 807 ms; phase 2 (draw): 1.2 s; total: 2.0 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 873 ms; phase 2 (draw): 4.3 s; total: 5.2 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 607 ms; phase 2 (draw): 4.3 s; total: 4.9 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 680 ms; phase 2 (draw): 4.3 s; total: 5.0 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 946 ms; phase 2 (draw): 4.3 s; total: 5.3 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 654 ms; phase 2 (draw): 4.3 s; total: 5.0 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 630 ms; phase 2 (draw): 4.4 s; total: 5.0 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 573 ms; phase 2 (draw): 4.6 s; total: 5.1 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 614 ms; phase 2 (draw): 4.3 s; total: 4.9 s (scale: 1088.6692085678621 zoom level: 13)
BENCHMARK: rendering phase 1 (calculate styles): 678 ms; phase 2 (draw): 4.3 s; total: 5.0 s (scale: 1088.6692085678621 zoom level: 13)

The cache is cleared completely after each rendering run. This measures the critical first rendering run. In subsequent runs, the cache kicks in and the overall time is dominated by phase 2.

comment:9 in reply to:  7 Changed 3 years ago by GerdP

Replying to bastiK:

@Gerd Petermann: Could you please open a new ticket for your work on the multipolygons?

OK, see #13289.

comment:10 Changed 3 years ago by simon04

Owner: changed from simon04 to team
Status: assignednew
Summary: [Patch] Use parallel stream for StyledMapRenderer, MultipolygonBuilder[Patch] Use parallel stream for StyledMapRenderer, MultipolygonBuilder?

comment:11 Changed 3 years ago by Don-vip

Milestone: 16.0816.09

comment:12 Changed 3 years ago by simon04

Milestone: 16.0916.10

comment:13 Changed 3 years ago by simon04

Milestone: 16.1016.11

Milestone renamed

comment:14 Changed 2 years ago by Don-vip

Milestone: 16.1116.12

Milestone renamed

comment:15 Changed 2 years ago by Don-vip

Milestone: 16.1217.01

comment:16 Changed 2 years ago by Don-vip

Milestone: 17.0117.02

comment:17 Changed 2 years ago by Don-vip

Milestone: 17.0217.03

comment:18 Changed 2 years ago by Don-vip

Milestone: 17.0317.04

comment:19 Changed 2 years ago by Don-vip

Milestone: 17.0417.05

comment:20 Changed 2 years ago by Don-vip

Milestone: 17.05

comment:21 Changed 22 months ago by bastiK

What is the prospect for this patch? Personally, I see no real advantage in using parallel streams or fork/join pool in these places. If Executors.newFixedThreadPool does the job, then this is the way to go: It is simple, solid and with little overhead. How can you beat it in terms of efficiency?

In any case, if measurements show other strategies to be consistently better, then that's a different story...

comment:22 Changed 22 months ago by michael2402

I'd say we close it. The code looks nicer using streams, but we lose a lot of performance.

I played around with streams a bit. They are nice but introduce a lot of overhead when handling many small items. I did not see any performance improvement.

comment:23 Changed 8 months ago by Don-vip

Keywords: multipolygon added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to simon04
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.