|
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
|
03-19-2013
, 17:12
Re: [ZP] Optimizacion de codigo 4.3
|
#12
|
Quote:
Originally Posted by ChileScripting
Segun tu tener estos 2 codes son totalmente iguales en gasto y rendimiento ?
PHP Code:
for (player = 0; player <= g_maxplayers; player++)
{
// Format text depending on the action to take
switch (PL_ACTION)
{
case ACTION_ZOMBIEFY_HUMANIZE: // Zombiefy/Humanize command
{
if (g_zombie[player])
{
if (allowed_human(player) && (userflags & VIP))
formatex(menu, charsmax(menu), "%s \r[%L]", g_playername[player], id, g_nemesis[player] ? "CLASS_NEMESIS" : "CLASS_ZOMBIE")
else
formatex(menu, charsmax(menu), "\d%s [%L]", g_playername[player], id, g_nemesis[player] ? "CLASS_NEMESIS" : "CLASS_ZOMBIE")
}
else
{
if (allowed_zombie(player) && (userflags & VIP))
formatex(menu, charsmax(menu), "%s \y[%L]", g_playername[player], id, g_survivor[player] ? "CLASS_SURVIVOR" : "CLASS_HUMAN")
else
formatex(menu, charsmax(menu), "\d%s [%L]", g_playername[player], id, g_survivor[player] ? "CLASS_SURVIVOR" : "CLASS_HUMAN")
}
}
PHP Code:
for (player = 0; player <= g_maxplayers; player++)
{
formatex(menu, charsmax(menu), "%s%s \r[%s]", ALLOWED_GLOBAL(player) && (userflags & VIP) ? "" : "\d", g_playername[player], gSpecialClases[gClase[player]][gSpecialNombre])
Edit: No desvirtuen el tema porfabor (:
|
Quote:
Originally Posted by XINLEI
Las diferencias son minusculas porque haces lo mismo.
|
Antes de que supuestamente me ponga a "desvirtuar" ponte a leer unas guias basicas de optimizacion y rendimiento
En si son lo mismo, una condicion de if y switches hara cambiar el gasto? Se quemara tu PC? La memoria aumentara? Preocupate de cachear valores que de reducir lineas, que trastorno los tontitos de hoy con confundir optimizacion con reduccion de lineas
__________________
Quote:
Originally Posted by joropito
You're right Metalicross
|
|
|
|
|