andrewgazelka / hyperion

10,000 Player PvP. One Minecraft World. One event.
Apache License 2.0
443 stars 20 forks source link

validate unsafe code #445

Closed andrewgazelka closed 1 week ago

andrewgazelka commented 5 months ago

go over unsafe code and double check it is all valid/makes sense. we do not want the server to suddenly crash during the 10k player event.

BGR360 commented 1 month ago

Step 1 of this endeavor, IMO, is to delete as much unsafe code as possible without tanking benchmarks. Literally delete it all if it still performs well afterward. Undefined behavior is not worth the trouble. How many usages of unsafe in this codebase are motivated by benchmark data, and how many of them are just "well, it ought to be faster this way, and faster is better"?

andrewgazelka commented 1 month ago

Step 1 of this endeavor, IMO, is to delete as much unsafe code as possible without tanking benchmarks. Literally delete it all if it still performs well afterward. Undefined behavior is not worth the trouble. How many usages of unsafe in this codebase are motivated by benchmark data, and how many of them are just "well, it ought to be faster this way, and faster is better"?

Yea, I have to go in a bench/profiling -> delete loop for this.

fortunately, there isn't a ton of explicit unsafe code sadly we are using flecs which can be subtly unsafe even when we arent explicitly using unsafe (although not very often)

biggest place where unsafe code is nice is probably for the BVH stuff, but that isn't being used a ton right now and can be tested/fuzzed pretty thoroughly.

andrewgazelka commented 1 week ago

closing as low prio for now