This is a short example of what i'm meaning. I want to know what do you think is better for script optimization:
Using Special Variables:
...
mes "Player ID: "+[color=#000000]getcharid(.@CharName$);[/color]
mes "Player Sex: "+((sex==0)?"Female":"Male");
mes "Player Level: "+BaseLevel+" / "+JobLevel;
mes "Player "+((upper==2)?"Is Child":"Is not Child");
...
Using query_sql:
...
query_sql("SELECT char_id,sex,base_level,job_level,father WHERE name = '"+escape_sql([color=#000000].@CharName$[/color])+"';"),.@CH_ID,.@CH_Sex$,.@CH_Blvl,.@CH_Jlvl,.@CH_Father);
mes "Player ID: "+.@CH_ID[color=#000000];[/color]
mes "Player Sex: "+((.@CH_Sex$=="F")?"Female":"Male");
mes "Player Level: "+.@CH_Blvl+" / "+.@CH_Jlvl;
mes "Player "+((.@CH_Father!=0)?"Is Child":"Is not Child");
...
First case:
- 1 temp string variable.
- 4 Special Variables (Sex, BaseLevel, JobLevel, Upper).
- 5 queries (getcharid to retrieve Char_ID and 1 query for every Special Variable).
Second Case:
- 6 temp variables (2 of them strings).
- Only 1 query.
What is your suggestion? Case one (less variables, more queries) or case two (less queries, more variables)?
Question
Brainstorming
This is a short example of what i'm meaning. I want to know what do you think is better for script optimization:
Using Special Variables:
Using query_sql:
First case:
- 1 temp string variable.
- 4 Special Variables (Sex, BaseLevel, JobLevel, Upper).
- 5 queries (getcharid to retrieve Char_ID and 1 query for every Special Variable).
Second Case:
- 6 temp variables (2 of them strings).
- Only 1 query.
What is your suggestion? Case one (less variables, more queries) or case two (less queries, more variables)?
Edited by Brainstorming3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.