Re: How do I get Timing results in Out[]//<Message>?
- To: mathgroup at smc.vnet.net
- Subject: [mg43920] Re: [mg43917] How do I get Timing results in Out[]//<Message>?
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Sun, 12 Oct 2003 04:03:41 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
How about this: $Pre = Function[{x}, Module[{y}, (Print[First[Timing[y = x]]]; y)], HoldAll] For example: In[5]:= Length[Select[Range[10^5],PrimeQ]] From In[5]:= 1.04 Second Out[5]= 9592 Not exactly as you have described it, but perhaps functionally equivalent (?) Andrzej On Saturday, October 11, 2003, at 06:07 PM, Scott Centoni wrote: > Thanks, but what I want is to put the timing info into the blue > Out[123]= line, not into the output itself, so it doesn't interfere > with things like IdentityMatrix[3]//MatrixForm, and %/%% and doesn't > crowd out or obscure the important stuff, the output. > > But I don't know enough about how the Out[]//stuff and display forms > work. > > On Saturday, October 11, 2003, at 10:18 Uhr, Andrzej Kozlowski wrote: > >> >> On Saturday, October 11, 2003, at 02:33 PM, Scott Centoni wrote: >> >>> I remember reading a very neat tip on how to get Timing[] wrapped >>> around >>> every evaluation by default, and the results printed out in the blue >>> Out[123]= line for each output cell in the notebook so that it >>> doesn't >>> clutter up your output. I think I remember reading this tip in The >>> Mathematica Journal, but I can't find it. Do any of you know what >>> I'm >>> referring to? >>> >>> Note that this is rather like >>> >>> In[54]:= >>> IdentityMatrix[4]//TableForm >>> >>> Out[54]//TableForm= >>> {{1, 0, 0, 0}, >>> {0, 1, 0, 0}, >>> {0, 0, 1, 0}, >>> {0, 0, 0, 1} >>> } >>> >>> and completely different from the following trick at the support web >>> site to put the timing in the status line, the lower left corner of >>> the >>> window: >>> >>>> How do I get Mathematica to display the timing of an evaluation in >>>> lower-left corner of my notebook? >>>> >>>> You can have the timing of each evaluation displayed in the >>>> lower-left corner of a notebook by going to the Option Inspector and >>>> adding the value "ShowTiming" to the option >>>> >>>> Notebook Options|Evaluation Options|EvaluationCompletionAction >>> >>> (http://support.wolfram.com/mathematica/interface/customize/ >>> displaytiming.html) >>> >>> which I find almost useless because as soon as your 5-minute >>> evaluation >>> finishes, it's timing is overwritten by the one after it, which only >>> takes 0.04 seconds. >>> >>> Thanks, >>> Scott >>> >>> >>> >> >> >> I am not sure this is the same method as the one you are referring >> to, but setting: >> >> $Pre = Function[{x}, Timing[x], HoldAll]; >> >> should do what you want. eg: >> >> In[2]:= >> Map[PrimeQ,Range[10^3]]; >> >> Out[2]= >> {0.06 Second,Null} >> >> >> >> >> >> Andrzej Kozlowski >> Yokohama, Japan >> http://www.mimuw.edu.pl/~akoz/ >> http://platon.c.u-tokyo.ac.jp/andrzej/ >> > > |---------------------------------------------------------| > | Scott A Centoni <scentoni at iis.ee.ethz.ch> | > | ETH Zürich Integrated Systems Laboratory | > | Gloriastrasse 35 ETZ J88 | > | CH-8092 Zürich Tel: +41 1 632 66 85 | > | Switzerland Fax: +41 1 632 11 94 | > |---------------------------------------------------------| > > > Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/