| Hello,
I'm not sure how to understand the part about feature freeze in last meeting notes. So here's a question on if I should submit it or not.
I implemented a simple task switcher in the RulesProcessor's endTurn:
synchronized public void endTurn() { Log4J.startMethod(logger, "endTurn"); long start = System.nanoTime(); int aktTurn = getTurn(); try { for (RespawnPoint point : respawnPoints) { point.logic(); } switch (aktTurn % 5) { case 4: for (RespawnPoint point : respawnPoints) point.checkRespawn(aktTurn); break; case 3: for (PlantGrower plantGrower : plantGrowers) plantGrower.regrow(aktTurn); break; case 2: for (Corpse corpse : corpses) corpse.logic(aktTurn); break; case 1: for (Blood blood : bloods) blood.logic(aktTurn); break; default: for (Door door : doors) { door.logic(aktTurn); } break; } scripts.logic(); } catch (Exception e) { logger.error("error in endTurn", e); } finally { logger.debug("End turn: " + (System.nanoTime() - start) / 1000000.0 + " (" + (aktTurn % 5) + ")"); Log4J.finishMethod(logger, "endTurn"); } }
and changed the classes that are called from here.
I changes Respawn point to split between NPC.logic() and respawn logic and changed all functions called in the switch statement so they work in the expected way even if they are not called every turn.
The result of the work based on debug output in the same timeframe since server restart is:
before the change:
27163 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 48.763 27475 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 59.88 27747 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 30.956 28042 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 25.506 28367 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 49.897 28643 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 25.122 28944 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 25.514 29245 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 25.56 29577 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 56.59 29861 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 37.79 30162 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 36.788 30479 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 52.618
after the change:
27230 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 23.367 (2) 27534 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 26.395 (3) 27853 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 44.554 (4) 28133 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 23.71 (0) 28434 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 23.408 (1) 28734 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 23.63 (2) 29051 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 39.153 (3) 29340 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 27.841 (4) 29636 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 22.706 (0) 29951 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 37.32 (1) 30237 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 22.881 (2) 30538 DEBUG games.stendhal.server.StendhalRPRuleProcessor - End turn: 23.527 (3)
it's not a major breakthrough but should give us a little air to breathe and the possibility to optimize it even more.
I checked all the functionality that is involved with the functions and all is working normal it seems.
So, do we have a code freeze or shall I submit it?
Regards, Jo
|