jrouwe / JoltPhysics

A multi core friendly rigid body physics and collision detection library. Written in C++. Suitable for games and VR applications. Used by Horizon Forbidden West.
MIT License
6.42k stars 414 forks source link

Replace std::vector with custom implementation #1089

Closed jrouwe closed 4 months ago

jankrassnigg commented 4 months ago

There comes a time when a man has to write their own array class.

Congratulations for this very important achievement :-)

jrouwe commented 4 months ago

There comes a time when a man has to write their own array class.

Congratulations for this very important achievement :-)

Yeah, I kept telling myself: std::vector is not that bad and I'll use it until it gets in the way of performance. Unfortunately, I recently learned that std::vector memsets the entire datablock to 0 before doing anything else and there doesn't appear to be a reasonable way around it. This was actually costing quite a bit of time when deserializing big meshes/height fields. And due to my self imposed restrictions that I cannot use 3rd party libs other than STL, I had to write my own 😞

jankrassnigg commented 4 months ago

There comes a time when a man has to write their own array class. Congratulations for this very important achievement :-)

Yeah, I kept telling myself: std::vector is not that bad and I'll use it until it gets in the way of performance. Unfortunately, I recently learned that std::vector memsets the entire datablock to 0 before doing anything else and there doesn't appear to be a reasonable way around it. This was actually costing quite a bit of time when deserializing big meshes/height fields. And due to my self imposed restrictions that I cannot use 3rd party libs other than STL, I had to write my own 😞

Yeah, been there, done that (for pretty much the entire STL). It's really sad that the STL is barely usable once you actually care about performance. But well, nothing else one can do about, I guess.

sonarcloud[bot] commented 4 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
12 Accepted issues

Measures
0 Security Hotspots
19.4% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud