#Jobs performance is slower than normal gameobject workflow

1 messages · Page 1 of 1 (latest)

stiff nova
#

Hello, Ive been following the dots course on Unity learn (https://learn.unity.com/tutorial/65b3de6bedbc2a59a499d5b9?uv=2022.3&projectId=65b3d3cfedbc2a5399ce3740#)
I completed part 5(Find each Seeker’s nearest Target with a single-threaded job) of module 2(Get started with Unity's Job System)

Every code I implemented is just a copy paste from the website and followed the course strictly without altering anything.
While profiling the performance difference, I find the normal gameObject workflow takes ~450ms to run a frame while single threaded job takes ~1000ms to run a frame. The website claims 340ms for normal gameobject workflow and 30 ms for single threaded job. Even when burst is enabled, my game runs in 19 ms while the website claim to run in 1.5ms. Im using 2022 lts version
Im running 32Gb Ram intel 13th gen i9 with rtx 4080

Unity Learn

This tutorial introduces fundamentals of using jobs to take advantage of multicore CPUs. By the end of this tutorial, you'll be able to do the following: Create, schedule, and complete single-threaded jobs. Create, schedule, and complete parallel jobs. Schedule jobs that depend upon other jobs. Use NativeArrays.

teal torrent
#

showing profiler data would explain things

stiff nova
#

With gamObjects

#

With Single threaded job

teal torrent
#

first of all - you don't use burst

#

then - you aren't really using jobs. YOu are completing job on main thread practically

#

so benefit of jobs here is negative

#

(in this specific example)

stiff nova
#

Im not using burst indeed. I wanted to check if a single threaded job without burst provide any performance boost

#

But you can see the worker 1 is busy executing. How exactly do I complete a job in a job thread?

teal torrent
#

that's it

stiff nova
#

ah

teal torrent
#

at least, not until you schedule enough jobs

stiff nova
#

But how do I do it?

teal torrent
#

in which case main thread would wait for hundreds of jobs to finish

teal torrent
#

(or using Unity ECS at advanced level)

#

but anyway

#

I think your job is written awfully

#

that's why it's so much slower

#

2x slower is really bad

#

I didn't follow this tutorial, so no idea what it has

stiff nova
#

this is a copy paste from Unity learn website. I made zero code changes. There is a vast difference from what the website claim and what I experience

teal torrent
#

which makes a massive difference

stiff nova
#

They use burst later. I use burst and managed to run a frame in 19ms but they claim 1.5ms

teal torrent
#

they use burst

#

not later, but in this exact part

#

green in profiler means burst

stiff nova
teal torrent
#

you mentioned 1.5ms - they only got it with burst

stiff nova
#

Thats what I said

#

1.5ms with dots. 30ms with just job and no burst. 300 ms for normal gamObject workflow

teal torrent
#

dots != burst

stiff nova
#

ah i meant burst sorry

teal torrent
#

show more of profiler

stiff nova
#

1.5ms with burst and single threaded job

teal torrent
#

I'm curious as well, why it's so much slowe