[comp.windows.x] text benchmarks

pokey@well.UUCP (Jef Poskanzer) (08/26/89)

In the referenced message, David Herron wrote:
}BTW, the textstone numbers are very close (15863 for Vs2000 & ether,
}14549 for NCD-16) and is probably the basis for my opinion that they're
}fairly equal.

Yes, I have also found that for general use, the text numbers are by
far the most important.  In fact, I went ahead and wrote Yet Another
Benchmark to measure text speed.  This one is different in that it's
portable -- all it does is time how long it takes to write out text,
so you can use it on any window system or no window system.

If people want to try it out and mail me their numbers, I'd be glad
to collect them and post a summary.
---
Jef

    Jef Poskanzer  pokey@well.sf.ca.us  {ucbvax, apple, hplabs}!well!pokey
      "All men were banished from the lunar suface because they couldn't

/*
** textbench - a simple and portable text-display benchmark
**
** Compile with:  cc -O textbench.c -o textbench
**
** Use:  textbench > results
**
** Results so far:
**						chars/sec	scrolls/sec
**
** Sun 3/50 SunOS3.5 X10.4 34x80 xterm		5128		414
** Sun 3/50 SunOS3.5 NeWS1.1 psterm		2752		218
** Sun 3/50 SunOS3.5 raw console		1435		132
**
** Sun 3/260 SunOS3.5 X10.4 34x80 xterm		10526		952
** Sun 3/260 hires SunOS3.5 NeWS1.1 psterm	3109		496
** Sun 3/260 hires SunOS3.5 raw console		1229		144
**
** HP 360 HPUX raw console			2715		110
** HP 360 HPUX X11.2 34x80 xterm		12000		588
**
** 9600 baud terminal				960		960
**
**
** Copyright (C) 1989 by Jef Poskanzer.
**
** Permission to use, copy, modify, and distribute this software and its
** documentation for any purpose and without fee is hereby granted, provided
** that the above copyright notice appear in all copies and that both that
** copyright notice and this permission notice appear in supporting
** documentation.  This software is provided "as is" without express or
** implied warranty.
*/

/* Increase or decrease these as necessary to get a reasonable running
** time.  On a Sun 3/50, 200000 chars and 20000 scrolls runs for a total
** of about fifteen minutes.
*/
#define CHARS 200000
#define SCROLLS 20000

#include <stdio.h>

#define min(a,b) ((a) < (b) ? (a) : (b))

main( argc, argv )
int argc;
char *argv[];
    {
    char *ttyname();
    FILE *fd;
    long t0, t1, t2, t3, t4, t5, t6;
    float tc, ts;

    if ( isatty( fileno( stderr ) ) )
	fd = stderr;
    else if ( isatty( fileno( stdout ) ) )
	fd = stdout;
    else if ( isatty( fileno( stdin ) ) )
	{
	fd = fopen( ttyname( fileno( stdin ) ), "a" );
	if ( fd == (FILE *) 0 )
	    {
	    perror( argv[0] );
	    exit( 1 );
	    }
	}
    else
	{
	fprintf( stderr, "%s: can't find a tty\n", argv[0] );
	exit( 1 );
	}

    t0 = time( 0 );
    chargen( fd, CHARS, 70 );
    t1 = time( 0 );
    chargen( fd, SCROLLS, 0 );
    t2 = time( 0 );
    chargen( fd, CHARS, 70 );
    t3 = time( 0 );
    chargen( fd, SCROLLS, 0 );
    t4 = time( 0 );
    chargen( fd, CHARS, 70 );
    t5 = time( 0 );
    chargen( fd, SCROLLS, 0 );
    t6 = time( 0 );

    tc = ( ( t1 - t0 ) + ( t3 - t2 ) + ( t5 - t4 ) ) / 3.0;
    ts = ( ( t2 - t1 ) + ( t4 - t3 ) + ( t6 - t5 ) ) / 3.0;

    printf( "chars / second:    %d\n", (int) ( CHARS / tc + 0.5 ) );
    printf( "scrolls / second:  %d\n", (int) ( SCROLLS / ts + 0.5 ) );

    exit( 0 );
    }

chargen( fd, chars, charsperline )
FILE *fd;
int chars, charsperline;
    {
    int i, j;

    for ( i = chars; i > 0; i -= charsperline + 1 )
	{
	for ( j = min( charsperline, i - 1 ); j > 0; j-- )
	    putc( '@', fd );
	putc( '\n', fd );
	}
    fflush( fd );
    }