Performance - Frequent update of PB access rights to blocks
Game version: 1.200.032
Called from MyProgrammableBlock.RunSandboxedProgramAction, which can be frequent on multiplayer servers with PBs triggered a lot.
The ownerID is the owner of the programmable block. Since block and PB ownership changes rarely, frequent calls can be inhibited.
What I did is just allowing for a call every 4-5 seconds, skipping the rest of them. It eliminates most of the CPU load with a minimal delay of access right updates after ownership changes as a potential side effect. There may be a better (proper) fix which invalidates the cache on relevant ownership changes.
See the UpdateGridBlocksOwnershipPrefix patch method of MyGridTerminalSystemPatch in https://github.com/viktor-ferenczi/performance-improvements
Run this test world in DS to reproduce (OneDrive due to its size): https://1drv.ms/u/s!AqEgz8G_d8TSh8wPzLoPp_dQDBRb7g?e=eBhsuv