nietras,
@nietras@mastodon.social avatar

What options are there to improve Parallel.For runs when WorkerThreadStart is taking 70% of CPU usage?

#dotnet #csharp

cincura_net,
@cincura_net@mas.to avatar

@nietras Can you share your code?

nietras,
@nietras@mastodon.social avatar

@cincura_net https://github.com/nietras/Llm.cs WIP, dotnet run Llm.csproj, first time will download some data. Port of @karpathy llm.c.

nietras,
@nietras@mastodon.social avatar

@cincura_net running code on another machine (with 16c/32t vs 8c/16t) and the RtlUserThreadStart Self CPU drops to ~1% (from 70%). Could this just be a profiler issue?

cincura_net,
@cincura_net@mas.to avatar

@nietras Could be. The screenshot looks like VS profiler, what kind of measurement are you using - sampling or instrumentation? Maybe you could try to collect trace from PerfView…

nietras,
@nietras@mastodon.social avatar

@cincura_net it's vs profiler, sampling, with high 4 khz sampling. could def. try perfview.

KirillOsenkov,
@KirillOsenkov@mastodon.social avatar

@nietras @cincura_net also try https://www.getcodetrack.com if you haven't yet

nietras,
@nietras@mastodon.social avatar

@KirillOsenkov @cincura_net turns out by refactoring some code out from delegate (lambda) to static methods then vs profiler reports it correctly. Guess would be code in delegate somehow causes stack frame to be incorrectly reported as top frame of thread start. Or something 😅

cincura_net,
@cincura_net@mas.to avatar

@nietras @KirillOsenkov Interesting.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • dotnet
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • megavids
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • provamag3
  • JUstTest
  • All magazines