Compress timing with different data types
- To: mathgroup at smc.vnet.net
- Subject: [mg97701] Compress timing with different data types
- From: Yves Klett <yves.klett at googlemail.com>
- Date: Thu, 19 Mar 2009 02:10:30 -0500 (EST)
Hi, I noticed that the speed of Compress is very much dependent on the type of data that is compressed: (*start*)data = RandomReal[{-1, 1}, {100, 10, 3}]; cdt = AbsoluteTiming[cd = Compress[data]][[1]]; udt = AbsoluteTiming[Uncompress[cd]][[1]]; lines = Line /@ data; scale = ByteCount[lines]/ByteCount[data]; clt = AbsoluteTiming[cl = Compress[lines];][[1]]/scale; cut = AbsoluteTiming[ul = Uncompress[cl];][[1]]/scale; TableForm[{{"", "Coordinates", "Lines", "Factor"}, {"Compress", cdt, clt, clt/cdt}, {"Uncompress", udt, cut}}] (*end*) Result: Coordinates Lines Factor Compress 0.0468738 2.6967411 57.5319 Uncompress 0. 0. So compressing an expression only containing lists and numbers is about 60 times faster than compressing an expression containing Line statements. And the difference gets worse the larger the expression becomes... On the other hand, Uncompress is not much affected... Does anyone have experience and/or a workaround with that behaviour (6.03 & 7.01 on WinXP)? Regards, Yves