Query about Transcript object

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Query about Transcript object

Ian Oversby-2
Hi,

I wrote the following line of code to display the numbers 1 to 200 in
the Transcript Window.

1 to: 200 do: [ :x | Transcript show: x ; cr ].

The numbers are displayed quite slowly and while they are being
displayed, I am unable to perform any other action, for example, click
on other Windows to raise them to the front or bring up the context
sensitive menu.  What am I doing wrong?

Thanks,

Ian
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

RE: Query about Transcript object

Ramon Leon-5
> Hi,
>
> I wrote the following line of code to display the numbers 1
> to 200 in the Transcript Window.
>
> 1 to: 200 do: [ :x | Transcript show: x ; cr ].
>
> The numbers are displayed quite slowly and while they are
> being displayed, I am unable to perform any other action, for
> example, click on other Windows to raise them to the front or
> bring up the context sensitive menu.  What am I doing wrong?
>
> Thanks,
>
> Ian

You aren't doing anything wrong.  The Transcript is very slow, it's meant
for debugging, never worry about speed while printing to the transcript.
Never print to the transcript when you're worrying about speed.

Squeak's UI runs do its on the same thread as the UI thread, so while you
execute any code in a workspace, expect the whole UI to lockup.

Ramon Leon
http://onsmalltalk.com 

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Query about Transcript object

Ian Oversby-2
Hi Ramon,

Thanks for the answers.

On 03/04/07, Ramon Leon <[hidden email]> wrote:

> > Hi,
> >
> > I wrote the following line of code to display the numbers 1
> > to 200 in the Transcript Window.
> >
> > 1 to: 200 do: [ :x | Transcript show: x ; cr ].
> >
> > The numbers are displayed quite slowly and while they are
> > being displayed, I am unable to perform any other action, for
> > example, click on other Windows to raise them to the front or
> > bring up the context sensitive menu.  What am I doing wrong?
> >
> > Thanks,
> >
> > Ian
>
> You aren't doing anything wrong.  The Transcript is very slow, it's meant
> for debugging, never worry about speed while printing to the transcript.
> Never print to the transcript when you're worrying about speed.

Is there an alternative way to log information then, that isn't so slow?

> Squeak's UI runs do its on the same thread as the UI thread, so while you
> execute any code in a workspace, expect the whole UI to lockup.

Is there a way to run code in the background so that the UI stays available?

> Ramon Leon
> http://onsmalltalk.com

Thanks,

Ian
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Query about Transcript object

Göran Krampe
Hi!

"Ian Oversby" <[hidden email]> wrote:

> Hi Ramon,
>
> Thanks for the answers.
>
> On 03/04/07, Ramon Leon <[hidden email]> wrote:
> > > Hi,
> > >
> > > I wrote the following line of code to display the numbers 1
> > > to 200 in the Transcript Window.
> > >
> > > 1 to: 200 do: [ :x | Transcript show: x ; cr ].
> > >
> > > The numbers are displayed quite slowly and while they are
> > > being displayed, I am unable to perform any other action, for
> > > example, click on other Windows to raise them to the front or
> > > bring up the context sensitive menu.  What am I doing wrong?
> > >
> > > Thanks,
> > >
> > > Ian
> >
> > You aren't doing anything wrong.  The Transcript is very slow, it's meant
> > for debugging, never worry about speed while printing to the transcript.
> > Never print to the transcript when you're worrying about speed.
>
> Is there an alternative way to log information then, that isn't so slow?

The reason for Transcript to be slow is the scrolling IIRC - lots of
bitmap copying etc.
It is much faster if you close the Transcript window. On my laptop it
then runs in 175 ms instead of about 5 seconds. Do "print it" on this:

        [1 to: 200 do: [ :x | Transcript show: x ; cr ]] timeToRun

In the Gjallar project we have also developed a little logging framework
which is quite nice.
I started breaking it out of Gjallar - almost done. Also there is a
package called Toothpick - haven't used it. And I think at least one
more logging lib on SqueakMap.

> > Squeak's UI runs do its on the same thread as the UI thread, so while you
> > execute any code in a workspace, expect the whole UI to lockup.
>
> Is there a way to run code in the background so that the UI stays available?

Sure, just fork it off. But then you might also get bitten by the fact
that Transcript is not thread safe! :)

        [1 to: 200 do: [ :x | Transcript show: x ; cr ]] fork

regards, Göran
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners