CesiumGS / CesiumGS/cesium-unity

Task.Run() creates too much garbage

Open
#204 0 comments 0 reactions 0 assignees View on GitHub
performance
Dominant language
C#
Stars
535
Forks
132
Avg merge
6h 45m
Merged PRs (30d)
1

Description

![Task Run](https://user-images.githubusercontent.com/13579475/217312941-cab7f6f2-94ca-4a8b-bbc5-683c2e8ef843.PNG)

In this screen shot you can see that calling System::Threading::Tasks::Task::Run(f); inside the UnityTaskProcessor::startTask function is creating too much garbage.

I switched to std::thread(f).detach() and see no problems.

Contributor guide

Open the contributing guide

Research direction

Start at UnityTaskProcessor::startTask and reproduce the reported garbage allocation when it calls System::Threading::Tasks::Task::Run(f). Compare the profiler result with the std::thread(f).detach() observation, then verify that the task-processing behavior is preserved while the excessive garbage is eliminated.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
game-dev, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.