I'm coding a game client, which now and then have huuuuuuge spikes
I can run around for minutes, and suddenly there's a 180ms spike for no reason at all
I've found where it happens, but consider this:
The area where it happens is something that runs ALOT, compiling hundreds of meshes per second
I just call it the precompiler, which prepares meshes, which is then transferred to rendering thread and "compiled" (uploaded) there
I generate the meshes in smaller chunks, which is then compiled on the rendering side to bigger based on certain criterias
This is done for obvious reasons: Time and the ability to re-use parts of the bigger structure later on enabling very fast modification of terrain
Anyways,
I'm sure everyone here has had their fair share of "interesting" problems with threadpools and mesh generation
Anyone have any tips for what i should look for?
The timing numbers are 99.8% what I'd expect them to be, within the time limit which i set out to keep myself within
Most (99%) run within the 0.0125 second mark, while 0.8% are slightly above (which is FINE, i know i can do better!)
However, there's that odd giga-spike which is ... insanely long, in the 100-200ms area
The threadpool I'm using is (or seems very,) professional:
http://www.hlnum.org/english/projects/tools/threadpool/doc.html
I schedule N jobs (mostly 1-4 depending on the preferences of the player/user), then i finish them immediately
I imagine its that latter "finish immediately" part that people will raise eyebrows at
Unfortunately for me, It's downright impossible to wait for the jobs to finish by themselves.. It simply won't work
The rest of the engine needs to be able to modify that data at ANY time in ANY way, including removing it completely
(Or even moving the data around)
Any ideas?