|
Posted by Onideus Mad Hatter on 10/30/58 11:23
On the blog site I experimented with your methodology for reducing the
overall amount of code using this:
: while(c0 <= num)
: {
: if (c0 == 2) { c4 = 180; c5 = 3; c6 = 0; }
: else if (c0 == 4) { c4 = 84; c5 = 1; c6 = 0; }
: else if (c0 == 6) { c4 = 683; c5 = 1; c6 = 0; }
: else if (c0 == 7) { c4 = 345; c5 = 0; c6 = 1; }
: else if (c0 == 8) { c4 = 366; c5 = 0; c6 = 1; }
: else if (c0 == 9) { c4 = 365; c5 = 0; c6 = 1; }
: else if (c0 == 10) { c4 = 226; c5 = 3; c6 = 0; }
: else if (c0 == 11) { c4 = 347; c5 = 0; c6 = 1; }
: else { c4 = 1; c5 = 0; c6 = 0; }
: while(c1 < c4)
: {
: if (IE) { document.write( $A + N[c0] + $B + Z[c0] + $C + L[c0] + $D + T[c0] + $E + W[c0] + $F + H[c0] + $G2 + I[c0] + $H2 ); }
: else { document.write( $A + N[c0] + $B + Z[c0] + $C + L[c0] + $D + T[c0] + $E + W[c0] + $F + H[c0] + $G1 + I[c0] + $H1 ); }
: L[c0] = L[c0] + c5;
: T[c0] = T[c0] + c6;
: c1++;
: }
: c0++;
: c1 = 0;
: }
As opposed to using this:
: document.write( $A + N[1] + $B + Z[1] + $C + L[1] + $D + T[1] + $E + W[1] + $F + H[1] + $G1 + I[1] + $H1 );
: for (count=0; count <= 180; count++)
: {
: document.write( $A + N[2] + $B + Z[2] + $C + L[2] + $D + T[2] + $E + W[2] + $F + H[2] + $G1 + I[2] + $H1 );
: L[2] = L[2] + 3;
: }
: document.write( $A + N[3] + $B + Z[3] + $C + L[3] + $D + T[3] + $E + W[3] + $F + H[3] + $G1 + I[3] + $H1 );
: for (count=0; count <= 84; count++)
: {
: document.write( $A + N[4] + $B + Z[4] + $C + L[4] + $D + T[4] + $E + W[4] + $F + H[4] + $G1 + I[4] + $H1 );
: L[4] = L[4] + 1;
: }
: document.write( $A + N[5] + $B + Z[5] + $C + L[5] + $D + T[5] + $E + W[5] + $F + H[5] + $G1 + I[5] + $H1 );
: for (count=0; count <= 683; count++)
: {
: document.write( $A + N[6] + $B + Z[6] + $C + L[6] + $D + T[6] + $E + W[6] + $F + H[6] + $G1 + I[6] + $H1 );
: L[6] = L[6] + 1;
: }
: for (count=0; count <= 345; count++)
: {
: document.write( $A + N[7] + $B + Z[7] + $C + L[7] + $D + T[7] + $E + W[7] + $F + H[7] + $G1 + I[7] + $H1 );
: T[7] = T[7] + 1;
: }
: for (count=0; count <= 366; count++)
: {
: document.write( $A + N[8] + $B + Z[8] + $C + L[8] + $D + T[8] + $E + W[8] + $F + H[8] + $G1 + I[8] + $H1 );
: T[8] = T[8] + 1;
: }
: for (count=0; count <= 365; count++)
: {
: document.write( $A + N[9] + $B + Z[9] + $C + L[9] + $D + T[9] + $E + W[9] + $F + H[9] + $G1 + I[9] + $H1 );
: T[9] = T[9] + 1;
: }
: for (count=0; count <= 226; count++)
: {
: document.write( $A + N[10] + $B + Z[10] + $C + L[10] + $D + T[10] + $E + W[10] + $F + H[10] + $G1 + I[10] + $H1 );
: L[10] = L[10] + 3;
: }
: for (count=0; count <= 347; count++)
: {
: document.write( $A + N[11] + $B + Z[11] + $C + L[11] + $D + T[11] + $E + W[11] + $F + H[11] + $G1 + I[11] + $H1 );
: T[11] = T[11] + 1;
: }
: document.write( $A + N[12] + $B + Z[12] + $C + L[12] + $D + T[12] + $E + W[12] + $F + H[12] + $G1 + I[12] + $H1 );
: document.write( $A + N[13] + $B + Z[13] + $C + L[13] + $D + T[13] + $E + W[13] + $F + H[13] + $G1 + I[13] + $H1 );
: document.write( $A + N[14] + $B + Z[14] + $C + L[14] + $D + T[14] + $E + W[14] + $F + H[14] + $G1 + I[14] + $H1 );
: document.write( $A + N[15] + $B + Z[15] + $C + L[15] + $D + T[15] + $E + W[15] + $F + H[15] + $G1 + I[15] + $H1 );
: document.write( $A + N[16] + $B + Z[16] + $C + L[16] + $D + T[16] + $E + W[16] + $F + H[16] + $G1 + I[16] + $H1 );
: document.write( $A + N[17] + $B + Z[17] + $C + L[17] + $D + T[17] + $E + W[17] + $F + H[17] + $G1 + I[17] + $H1 );
: document.write( $A + N[19] + $B + Z[19] + $C + L[19] + $D + T[19] + $E + W[19] + $F + H[19] + $G1 + I[19] + $H1 );
: document.write( $A + N[20] + $B + Z[20] + $C + L[20] + $D + T[20] + $E + W[20] + $F + H[20] + $G1 + I[20] + $H1 );
: document.write( $A + N[21] + $B + Z[21] + $C + L[21] + $D + T[21] + $E + W[21] + $F + H[21] + $G1 + I[21] + $H1 );
: document.write( $A + N[22] + $B + Z[22] + $C + L[22] + $D + T[22] + $E + W[22] + $F + H[22] + $G1 + I[22] + $H1 );
: if (IE)
: {
: document.write( $A + N[18] + $B + Z[18] + $C + L[18] + $D + T[18] + $E + W[18] + $F + H[18] + $G2 + I[18] + $H2 );
: document.write( $A + N[23] + $B + Z[23] + $C + L[23] + $D + T[23] + $E + W[23] + $F + H[23] + $G2 + I[23] + $H2 );
: document.write( $A + N[24] + $B + Z[24] + $C + L[24] + $D + T[24] + $E + W[24] + $F + H[24] + $G2 + I[24] + $H2 );
: document.write( $A + N[25] + $B + Z[25] + $C + L[25] + $D + T[25] + $E + W[25] + $F + H[25] + $G2 + I[25] + $H2 );
: }
: else
: {
: document.write( $A + N[18] + $B + Z[18] + $C + L[18] + $D + T[18] + $E + W[18] + $F + H[18] + $G1 + I[18] + $H1 );
: document.write( $A + N[23] + $B + Z[23] + $C + L[23] + $D + T[23] + $E + W[23] + $F + H[23] + $G1 + I[23] + $H1 );
: document.write( $A + N[24] + $B + Z[24] + $C + L[24] + $D + T[24] + $E + W[24] + $F + H[24] + $G1 + I[24] + $H1 );
: document.write( $A + N[25] + $B + Z[25] + $C + L[25] + $D + T[25] + $E + W[25] + $F + H[25] + $G1 + I[25] + $H1 );
: }
As you can see, your method cuts the code by a significant factor,
however the difference in loading times is about SEVEN SECONDS!
o_O
Seven seconds on dialup is equal to about 42 KB, where as the bloat
code is only about 3.15 KB bigger than teh uber compact code. All
this stuff makes me wonder though about other shortcuts, for example
is there a similar difference between:
:document.write( $A + N[1] + $B + Z[1] + $C + L[1] + $D + T[1] + $E + W[1] + $F + H[1] + $G1 + I[1] + $H1 );
and:
:document.write("<div style='position:absolute; left:55px; top:32px; width:156px; height:26px '><img src='0.png'></div>");
With that I find it's easier to make alterations later when I have
everything in an easy to see laid out array, but I wonder just how
much overall client side speed I'm sacrificing for my convenience.
--
Onideus Mad Hatter
mhm ¹ x ¹
http://www.backwater-productions.net
Navigation:
[Reply to this message]
|