Any chance you'd put this on Github? It'll allow others to work on it and is also easier if someone wants to translate it as they'll be able to access the files "directly" and create pull requests.
Basically I've made some performance improvements because Hardcorio went literally unplayable (took over 12ms per update tick). It's only been 2 "major" changes that fixed it, but I've tried to do some more tweaks here and there.. though it's rather hard to optimize what's left now. Anyway, I've went down to one 5th or 6th of what it used to use. It's still 10 times bigger than the mod "Bottleneck" (https://mods.factorio.com/mod/Bottleneck) and that one is already doing a lot (and known for its not so small impact)
There's one game changing thing I did though... Turrets and Radars work entirely differently from before.
I couldn't get rid off looping over all Radars and energy Turrets because energy might go down (unless I figure out how to access and list power grids) so I'm calculating the radar's and turret's operating percentage based on energy level, so a radar at 50% energy is only worth half a radar would... so on medium difficulty that is 3.5 radar slots instead of 7.
The same is true for a turret though, so an energy turret at 50% energy is also only worth half a turret (it's only shooting half the time, so that's fair)
What happens when "slots < turrets" is that they simply start to miss. That is, 80 slots, 100 turrets means 20% of shots miss. I've currently set upper and lower limits though. So a >90% (<100%) chance is actually 90% to punish people from going below what's "required", a 0% chance is also 0.05% to at least hit something (spray & pray). I originally thought about adding critical hits like a 110% chance to hit if you've got some spare radar slots (10% to crit and deal double dmg). Or it could scale with slots.. like having double the required slots means a 100% chance to do critical hits.... But I think that might imbalance things... It would be easy to add though.
Btw. this change also removed the "not enough radars" message because turrets that miss popup a red "miss" text above their heads, so it's kinda obvious. "Radar slots" also shows the percentage if below 100%
Theoretically it's possible to get rid of radar and turret loops altogether... turret loops could be ignored to make things even harder (turret only half at speed, yet counting as a fully working one, same for unpowered turrets) and radar loops would be possible to ignore... since there's the "on_sector_scanned" callback.. but a radar takes 33.33 seconds to scan a sector.. so the radar count would only change every 33.33 seconds and might fluctuate between "cycles" so it'll look weird.
EDIT: I forgot that the loops for electric turrets are required... as they're not using normal electricity.