New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CorporationAPI - assignJob very slow #2997
Comments
Looks like this is intentional:
Maybe in order to prevent dynamically switching emloyees between positions for the production and selling periods during a corporation cycle? |
Trying to sequentially reassign employees is proving to be painful ... 6 industries, 6 offices per industry, 100 employees per office, each taking 1 second ... this means 1 hour total time. That or I need to figure out how to do the calls in parallel whilst waiting for 3600 promises to return before moving on. |
The 1 second is intentional Its copied from the original assign. |
@ThatGuyinIT a workaround is to have it running in a separate script but that is another 1tb ram (but i assume by the point your at this many employyees you should have enough money to buy more home ram) |
@phyzical Yes, though to make it in any way efficient, that I would want 6 scripts running in parallel (and thus 6TB), which would still only bring it down to 10 minutes to complete. |
is there a reason you need to reassign so many employees? wouldn't it just be a gradual increase in all positions? (minus reassigning researchers?) |
@phyzical it is just ease of code - it is just easier to reassign based on percentages, e.g. first 40% are Ops, next 20% Engs etc, rather than each time count how many are in the existing role and do the delta each time, e.g. an office maxes out Research or adds 30 new hires. It means that each time, you just run through the full list of employees again. The 1 second delay just means that a lot more logic has to be wrapped around this one single action than feels necessary. |
why not just ask to assign those values? you shouldn't need to reassign. i.e say you have 100 employees 40% would be 40, then next time say there is 200 emplyees, then 40% is 80 just provide 40 then 80 and it will just asign another 40 instead of unassigning 40 then reassigning 80 maybe we need to update the desc of it, it doesn't assign the amount each time rather gets it to the value selected. |
I added some logic to not reassign employees to the same jobs they already have, that saves the majority of the time. I just don't want to spend too much time worrying about this aspect of the bitnode when the whole Corp has so many other moving pieces that have to be considered, e.g. divisions, offices, products, corp upgrades, division research, etc. |
i understand, there is other prs that has been confirmed to speed things up. im just giving you some suggested workaround for now, as there is not ETA when these will make in into prod |
Frankly most people don't bother with multiple working divisions so its not a problem for them, I think any change to this would go with a more robust change to the corp mechanic that would make using multiple corps more viable. |
agreed, there is alot of loop all x -> y > z that is repeated that could be refactored/consolidated |
This is intended, otherwise players can just assign their employee every corporation cycle and cheat the system. |
When using ns.corporation.assignJob() in a script, it is very slow - far slower than simply clicking through the Corp UI. It feels like a defect.
The text was updated successfully, but these errors were encountered: