Settings

The page will reload to apply your changes.
Theme

ASCII Art Font

ASCII Art Menu

Original Usenet message from alt.ascii-art.animation, 1 Mar 1994.
Re: Slow down the animation

Re: Slow down the animation

In <199...@ll.mit.edu>,
lod...@ll.mit.edu (Tom R. Loden *8^0) writes:
> Well, on a Sun SPARC II, it didn't seem to slow things down
> at all.  But using usleep() was TOO slow.  I found inserting
> a dummy loop did just fine. 

( it did slow it down on mine... but on other points:...)

problem with dummy loops is they're much less processor efficient.

also, you CAN change the argument to usleep()...  the argument is in
microseconds (and will be some arbitrary amount more than what you
specify, depending on system load, overhead for the call, etc.).

(what i did was to add something like this in the code:...

    /* delay between charachters, in microseconds */
    #define DELAY 1000

 ...and change the "1000" argument to usleep() to "DELAY")

unfortunately, on the system i'm currently on, i don't have usleep,
or it's in a library other than what i'm compiling with, or
something, but there are a few other things that i would suggest to
make the program more efficient (which you'll then slow back down,
to make it be just as you want it)

first, you might want to get rid of the fflush(), and optionally
replace it with a call to put you in cbreak mode.  (not sure off
hand how to do this on most platforms when you're not acting on
stdin as your stream... though i suppose you could close stdin and
re-open it as the other file, and then just call cbreak() ;-)

also, change your primary loop do something more like this:

    while ( (c=getc(stream))!=EOF )
    {
	delay ();
	putc (c, stdout);
    }
    fclose (stream);

(the old version, which i'd have to post this to go back to, at the
moment, was SOMETHING like:

    while( feof(stream) != EOF )
    {
	int c=getc(stream);

	if(c==EOF)
	{
	    fclose(stream);
	    return;
	}
	fflush(stream);
	putc(c,stdout);
    }

...   much more overhead, more calls, etc., slowing the program down
tremendously.)


there may be other things you can do too, but i'm not thinking of
much more, at the moment...

cheers.


	david lindes
	lin...@asd.sgi.com

P.S.	PLEASE NOTE:  the intent of this message is not to cut down
	anyone's code!!!  the intent is to provide some suggestions
	that may help more people have a more versitile "scat"
	program.  i hope it helps.


P.P.S.	#include <std_disclaimer.h>

Original message headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fd588,75064a58c47bba35
X-Google-Attributes: gidfd588,public
X-Google-ArrivalTime: 1994-02-28 21:29:35 PST
Newsgroups: alt.ascii-art.animation
Path: gmd.de!xlink.net!howland.reston.ans.net!usenet.ins.cwru.edu!nigel.msen.com!well!barrnet.net!sgiblab!sgigate.sgi.com!odin!training!lindes
From: lin...@training.asd.sgi.com (David Lindes)
Subject: Re: Slow down the animation
Message-ID: <CLz...@odin.corp.sgi.com>
Sender: new...@odin.corp.sgi.com (Net News)
Nntp-Posting-Host: training.asd.sgi.com
Organization:  Silicon Graphics, Inc.  Mountain View, CA
References: <RFB...@fnord.lehman.com> <199...@ll.mit.edu>
Date: Tue, 1 Mar 1994 05:29:35 GMT
Lines: 78
About this message. This message was posted publicly to the newsgroup alt.ascii-art.animation in 1994 and is mirrored here unchanged as part of the Historic Archives – only email addresses are masked. The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can. Are you the author? Contact us to get your posts attributed, connected to your artist profile, or removed.

Report this message

Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.

Help classify this post