Preserved Topic: Making the script smaller |
|
---|---|
Author | Thread |
Bipolar (III) Inmate From: Stockholm, Sweden |
posted 04-19-2002 15:00
Hi, I have made a script that calculates some stuff... I just wonder if I can make it smaller in bytes? I heard u could use something with 'eval' to get the field name and then cut the script with 3/4... Am I right? |
Bipolar (III) Inmate From: London, UK |
posted 04-19-2002 15:24
I'm guessing the easiest way to cut it down would be to set a variable for all the occurences of |
Paranoid (IV) Inmate From: Lebanon |
posted 04-19-2002 15:47
smash, in addition to what stinx said, you can: |
Bipolar (III) Inmate From: Stockholm, Sweden |
posted 04-19-2002 15:53
Thanks for the tips stinx and lallous! |
Paranoid (IV) Inmate From: Lebanon |
posted 04-19-2002 16:16
since you want to save bandwidth try using tools like HTMLCompress ... |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 04-20-2002 06:37
Using eval() function can only make your script run slower. Also, that function can't replace if statements, only thing that you can optimize is what stinx & lallous said. And in addition to all that you can also remove all whitescape characters (each character = one byte), like spaces, new lines, etc... |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 04-20-2002 09:15
the eval() function isn't necessary. But whoever told you that was on the right track. Your script has four parts that are almost exactly the same: |
Bipolar (III) Inmate From: Stockholm, Sweden |
posted 04-22-2002 10:34
Thank you very much for all help! |