some code performance questions...
Posted: Mon Jan 31, 2011 9:31 am
hi everyone,
as a non-pro part time noob dev I always try to pay attention to code effectiveness/efficiency/performance etc. I would like to ask you (and I bet there are at least dozens or so pro devs among all ppl involved in l2j project) several questions:
1. What's less "heavy" for the server? let's say we have e.g.:
2. I'm thinking about adding custom field in characters table which will contain player's amount of deaths during pvp. In order to fill the fields I'm going to put some checks into doDie method inside the L2PcInstance class.
My question is: will it affect a lot the gameplay performance if I update the DB every time the char dies in pvp? (which means every death = DB connection) or would it be better if I store the deaths amount in a variable somewhere inside the L2PcInstance class and update it using threadpoolmanager? (I must take under consideration that some chars may catch DC and handle that occurence too)
I hope you don't mind me asking these questions. Looking forward to get some hints.
Thx in advance!
as a non-pro part time noob dev I always try to pay attention to code effectiveness/efficiency/performance etc. I would like to ask you (and I bet there are at least dozens or so pro devs among all ppl involved in l2j project) several questions:
1. What's less "heavy" for the server? let's say we have e.g.:
Code: Select all
// code 1NpcHtmlMessage msg = new NpcHtmlMessage(0)msg.setHtml(HtmCache.getInstance().getHtm(prefix, path));player.sendPacket(msg); // code 2// subquestion: what about TextBuilder() classStringBuilder sb = new StringBuilder(); sb.append( /* html tags */);NpcHtmlMessage msg = new NpcHtmlMessage(0);msg.setHtml(sb.toString());player.sendPacket(msg);
My question is: will it affect a lot the gameplay performance if I update the DB every time the char dies in pvp? (which means every death = DB connection) or would it be better if I store the deaths amount in a variable somewhere inside the L2PcInstance class and update it using threadpoolmanager? (I must take under consideration that some chars may catch DC and handle that occurence too)
I hope you don't mind me asking these questions. Looking forward to get some hints.
Thx in advance!