Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Rugby compressed vs. not compressed content delivery tests ...

From: petr::krenzelok::trz::cz at: 12-Feb-2002 9:51

Hi, so I finally managed to find out how to turn off default compression of Rugby. As Maarten stated - new Rugby core uses compression for all content delivery. From my experience I know that compressing some type of data is not effective - in fact - you can turn your data into being ever bigger in size. So I wanted to give it a try and here is my result: I choosed one jpg file and tested if compression is effective here: ->> img: read/binary %coins.jpg == #{ FFD8FFE000104A46494600010201012C012C0000FFED013450686F746F73686F 7020332E30003842494D03ED000000000010012C000000010001012C0000... ->> length? img == 221052 ->> length? compress copy img == 220809 As you can see, you will not save any significant amount of space here. So it is clear, that compression/decompression itself will eat some cpu time, so let's measure it: first let's lower the size of image to some 50 kb ->> str-img: to-string copy/part img 50000 == {ÿØÿà^@^PJFIF^@^A^B^A^A,^A,^@^@ÿí^A4Photoshop 3.0^@8BIM^Cí^@^@^@^@^@^P^A,^@^@^@^A^@^A^A,^@^@^@^A^@^A8BIM^Có^@^@^@^@^@^H^@^@ ^@^@^... Now let's go to test. Each test was performed twice, to remove possible random result times ... Rugby compressed: ->> s: now/time loop 10 [echo mold str-img] print now/time - s 0:02:24 ->> s: now/time loop 10 [echo mold str-img] print now/time - s 0:02:24 Rugby non compressed: ->> s: now/time loop 10 [echo mold str-img] print now/time - s 0:01:02 ->> s: now/time loop 10 [echo mold str-img] print now/time - s 0:01:02 Some 130 % difference in performance ... So - is that correct to compress transmitted data by default? It depends upon what you use Rugby for. If you generate some XML/HTML/textual content, yo are probably OK. But if you are not? I am fully after compressing stubs transfer for e.g., as we saw significant difference with GoRim app - 46KB vs 6KB. But I would better let the user to decide, if he/she wants to use compression or not .... So, please, if I am not corrent in some points, feel free to corret me :-) E.g. look at following case: ->> s: now/time loop 10 [x: compress str-img decompress x x: compress str-img decompress x] print now/time - s 0:00:01 compression/decompression is used two times in Rugby, so I just tested it. Of course I don't know, how large chunks of data are transferred at once, and so how many compression/decompression operations are applied, but even full size of tested image compression/decompression as used in an example, takes only 1 sec, so where does tested difference comes from? ... Cheers, -pekr-