Implemented several optimizations - running scripts dont keep track of script refs or a map of ALL servers. Not completely tested yet

This commit is contained in:
danielyxie
2019-02-05 23:06:48 -08:00
parent dc63b14476
commit 8c8e3f2476
11 changed files with 98 additions and 771 deletions
+4 -2
View File
@@ -33,8 +33,10 @@ export function getPurchaseServerLimit() {
}
export function getPurchaseServerMaxRam() {
// TODO ensure this is a power of 2?
return Math.round(CONSTANTS.PurchasedServerMaxRam * BitNodeMultipliers.PurchasedServerMaxRam);
const ram = Math.round(CONSTANTS.PurchasedServerMaxRam * BitNodeMultipliers.PurchasedServerMaxRam);
// Round this to the nearest power of 2
return 1 << 31 - Math.clz32(ram);
}
// Manually purchase a server (NOT through Netscript)