RE: Protection against some Fr
- To: mathgroup at smc.vnet.net
- Subject: [mg13038] RE: [mg12943] Protection against some Fr
- From: Ersek_Ted%PAX1A at mr.nawcad.navy.mil
- Date: Sat, 4 Jul 1998 16:44:45 -0400
- Sender: owner-wri-mathgroup at wolfram.com
I would rather be more conservative and use: $ManyBytes=50000; reallyBig[x_] := If[ByteCount[x] >$ManyBytes, "Too Large", x]; $Post = reallyBig; I can always temporarily change $ManyBytes to a larger number if I want to. Now suppose ByteCount[x] is far bigger than 50000 ( ie. on the order of 10^7 ). The code above will not finish until it computes the exact value of ByteCount[x]. It would be nice if I could let the test come out False as soon as the kernel counts 50001 bytes in (x). That would make $Post run a lot faster when the output expression is very large. How can I do what I want? Ted Ersek | | |As mentionned in a few messages recently it is not uncommon to make a |mistake and then get a huge output to be generated. When that happens, |one is either stuck for a long time or crashes. | |A while back, support at Wolfram gave me this trick that I now have at |the top of any notebook manipulating large amount of data: | |reallyBig[x_] := If[ByteCount[x] > 200000, "Too Large", x]; | $Post = reallyBig; | |It will replace any "large" output by the string "Too Large". I cannot |count how many times this saved me. Hope it helps you too. | |Experience as shown that 200000 enabled me to always see what I want. | |Sincerely, | |Luc Barthelet |GM at day, Mayor at Night |http://www.simcity.com