Performance, improved ShapesMeshGen.cs performance by removing a local lambda

Avatar
  • updated
  • Completed

Hello! We were running into expensive per-frame costs from ShapesMeshGen.GenPolylineMesh. ~12% of the cost came from the local SetUv0 lambda. Replacing this lambda with a standard function reduced the cost to ~6%.

A bit of an older version of Shapes so this may no longer be a relevant change.

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
3.0.0
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Completed

okay - looks like the performance isn't because it's a local function, but rather because it captures variables. I've now made it a non-capturing local function, so this performance gain is now in for 4.2.0

Avatar
Freya Holmér creator

hm, that's, pretty strange though, it's a local function, not a lambda, I would expect the same performance characteristics :0

Avatar
Freya Holmér creator
  • Answer
  • Completed

okay - looks like the performance isn't because it's a local function, but rather because it captures variables. I've now made it a non-capturing local function, so this performance gain is now in for 4.2.0

Avatar
Patrick DeVarney

Excellent, thank you for investigating!