korlibs / korlibs/korge

Expensive Views.render() allocations

Open
#1,357 1 comment 0 reactions 0 assignees View on GitHub
enhancement optimization performance
Dominant language
Kotlin
Stars
3k
Forks
148
Avg merge
13h 44m
Merged PRs (30d)
1

Description

Hello! In shape-intensive applications, there's a visible memory allocation impact related to `Views.render()` calls.

![image](https://user-images.githubusercontent.com/3989453/220440926-362ac414-f005-430d-b611-8d9b2e7d8d31.png)

It seems like the first candidates for memory optimization/buffering/pooling would be:
- `getPoints2List`: some `Double` boxing still takes place? Expensive `PointArrayList` allocations.
- `GpuShapeViewPrograms.paintToShaderInfo(Matrix, Paint, double, double)`: Expensive `AGUniformValues` allocations (repeatedly created `private val data = Buffer(capacity)`)
- `GpuShapeViewCommands.finish()`: Repeatedly created `Float32Buffer` & underlying `Buffer`, `toFloatArray` copies.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing Views.render() into getPoints2List, GpuShapeViewPrograms.paintToShaderInfo(Matrix, Paint, double, double), and GpuShapeViewCommands.finish(). Inspect the reported PointArrayList, AGUniformValues, Float32Buffer, Buffer, and toFloatArray allocations. Done means reducing the repeated allocations or copies identified in these paths, though the issue does not specify a target measurement or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
game-dev, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.