Just now, a friend asked me on MSN that there are many blank characters on his page, and when I opened the source file, I found that the code was very sparse. He felt it was a waste and said there was a way to get rid of them. I asked him "Is your page compressed with GZip?" He said he used it, so I replied, "Then you don't need to remove the blank characters, the continuous spaces are well compressed, and the effect is not great after removing them." At this time, I couldn't help but think that there was also a section in the morning "Blog Park Homepage Optimization Experience" that was "removing spaces and blank lines in HTML", so I planned to try it to see how effective it was to remove white spaces.
"Blog Park Homepage Optimization Experience":The hyperlink login is visible.
My experimental goal is the detail pages of the first 40 articles on my blog, which range from 98K to 277K before compression, which I think is a typical page size in a blog garden. I use test code like this:
In the above code, I used the method of removing whitespace characters from Bloggarden, and the result is as follows:
| Original page | Original page (compressed) | After removing the blanks | After Blank (Compressed) | Before and after removing the blanks | Before and after blanking (compression) | | 130760 | 36018 | 117354 | 34702 | 13406 | 1316 | | 255935 | 63406 | 240433 | 61870 | 15502 | 1536 | | 278871 | 86794 | 263704 | 85298 | 15167 | 1496 | | 221248 | 53148 | 205440 | 51548 | 15808 | 1600 | | 151612 | 40260 | 137939 | 38940 | 13673 | 1320 | | 135019 | 36000 | 121593 | 34750 | 13426 | 1250 | | 128239 | 36230 | 114658 | 34878 | 13581 | 1352 | | 161530 | 42776 | 147189 | 41392 | 14341 | 1384 | | 99884 | 28372 | 87047 | 27084 | 12837 | 1288 | | 173534 | 43724 | 158446 | 42272 | 15088 | 1452 | | 191519 | 50398 | 176958 | 48888 | 14561 | 1510 | | 176996 | 40274 | 162706 | 38978 | 14290 | 1296 | | 206348 | 47362 | 191400 | 45964 | 14948 | 1398 | | 137014 | 38608 | 122855 | 37076 | 14159 | 1532 | | 144715 | 37260 | 131097 | 35748 | 13618 | 1512 | | 146531 | 36704 | 132619 | 35302 | 13912 | 1402 | | 199915 | 49224 | 182227 | 47452 | 17688 | 1772 | | 106929 | 29850 | 93690 | 28518 | 13239 | 1332 | | 136264 | 36664 | 121548 | 34990 | 14716 | 1674 | | 148750 | 37990 | 134567 | 36578 | 14183 | 1412 | | 282886 | 71924 | 266336 | 70306 | 16550 | 1618 | | 176099 | 41468 | 161322 | 40126 | 14777 | 1342 | | 108394 | 30456 | 95428 | 29216 | 12966 | 1240 | | 152578 | 40186 | 138543 | 38866 | 14035 | 1320 | | 230243 | 59970 | 215389 | 58554 | 14854 | 1416 | | 251183 | 57156 | 234862 | 55694 | 16321 | 1462 | | 196957 | 48176 | 181608 | 46776 | 15349 | 1400 | | 172267 | 41340 | 158105 | 40056 | 14162 | 1284 | | 265877 | 63650 | 248974 | 62142 | 16903 | 1508 | | 147403 | 38894 | 133751 | 37492 | 13652 | 1402 | | 149091 | 36460 | 134998 | 35190 | 14093 | 1270 | | 167741 | 43200 | 153614 | 41856 | 14127 | 1344 | | 171564 | 40898 | 157333 | 39648 | 14231 | 1250 | | 125812 | 34570 | 111047 | 33200 | 14765 | 1370 | | 190649 | 46524 | 175197 | 45040 | 15452 | 1484 | | 153807 | 39462 | 139401 | 38054 | 14406 | 1408 | | 120788 | 32228 | 107534 | 30930 | 13254 | 1298 | | 163327 | 41110 | 148763 | 39710 | 14564 | 1400 | | 103101 | 29476 | 90284 | 28222 | 12817 | 1254 | | 141384 | 39784 | 126641 | 38350 | 14743 | 1434 |
It is worth paying attention to the last two columns, from which we can find that although the page volume can be reduced by more than a dozen K before and after removing the blanks, butAfter compression, the difference is actually only 1-2K - about 1-2 packets。 Are these savings worth it? Furthermore, Blog Garden's practice is to replace the content of each page with regular expressions, so is it worth the cost? This is up to the blog garden to profil itself......
Finally, in fact, removing whitespace characters is not such a simple thing. The simplest example is: Have you come across some HTML editors or RSS readers that turn an otherwise neat code into a line in an article? This is because they arbitrarily remove all whitespace, but forgot that there is an HTML tag called <pre/>......
|