CesiumGS / CesiumGS/cesium

CPU Perf Issues (photogrammetry/julie)

Open
#7,400 3 comments 0 reactions 0 assignees View on GitHub
category - 3d tiles
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Just documenting current CPU perf issues in cesium (photogrammetry/julie).

representative of `combineRelease`.

Biggest and most consistent bottleneck: gl.texImage2D -> imageDecode. The only way to shorten it within in a frame is to texSubImage2D (upload images a chunk at a time) but this will make scene loading much longer. createBitmapImage was created to offload some of the heavy work performed by texImage2D in an async manner so that the blocking texImage2D won't take so long. All of this according to:
https://stackoverflow.com/questions/51710067/webgl-async-operations

![photogram_teximage2dimagedecode](https://user-images.githubusercontent.com/13598291/49759276-35ec4680-fc8f-11e8-918c-7095ad99d6fa.png)

![photo_batchedmodelupdate](https://user-images.githubusercontent.com/13598291/49759507-f2460c80-fc8f-11e8-8f9a-5bcd04363ca7.png)

Original attempt to solve using createBitmapImage: #6624
If multiple createBitmapImage calls can be done in parallel would need to promisify further up the call stack (model.update within batched3dmodel3dtilecontent.update?).
![photo_createbitmapimage](https://user-images.githubusercontent.com/13598291/49759578-1efa2400-fc90-11e8-9037-bb357295cd79.png)

createImageBitmap vs not. Red bars are the chrome profilers way of indicating that there's a really low fps at that point.
![nyc_nonbitmap_vs_bitmappng](https://user-images.githubusercontent.com/13598291/49900065-800a2f00-fe2b-11e8-9724-6c9eb2edae90.png)

Related to above, model updates in a batched model update. Possible to promisify in any way?
![photot_manymodelupdates](https://user-images.githubusercontent.com/13598291/49760284-186cac00-fc92-11e8-94d2-daaaacba0805.png)
Traversal time consistently dominated by updateVisibility. Ex:
![photo_manyupdateandpushchildren](https://user-images.githubusercontent.com/13598291/49760035-66cd7b00-fc91-11e8-8a7f-483d3f4183ee.png)

'Run microtasks' taking up this much time is surprisingly (or unsurprisingly?) common.
![photo_microtasks](https://user-images.githubusercontent.com/13598291/49760936-aac17f80-fc93-11e8-97c4-21d681290097.png)

Misc:
RequestScheduler.getServerKey chews up most of the time in RequestScheduler.request

Contributor guide

Open the contributing guide

Research direction

Start by profiling the photogrammetry/julie combineRelease case, focusing on gl.texImage2D/imageDecode, createBitmapImage, model.update, batched3dmodel3dtilecontent.update, updateVisibility, and RequestScheduler.getServerKey. Compare the referenced createImageBitmap and non-bitmap traces; the issue does not define a concrete fix or acceptance criteria, so what counts as done remains unspecified.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.