On Wed, 2006-05-10 at 16:25 +0200, Nagatoro wrote:
> Matthias Langer wrote:
> > On Wed, 2006-05-10 at 13:58 +0200, Matthias Langer wrote:
> >> On Wed, 2006-05-10 at 07:51 +0200, Nagatoro wrote:
> >> [snip]
> >>> Least:
> >>> ... Gnome-terminal, slow, and in my opinion horrible color support.
> >> [snip]
> >>
> >> Gnome terminal used to be slow, but vte (the underlying library) has
> >> beem optimized heavily during the last few month. I've a simple program
> >> that measures the speed of terminals. According to this program
> >> gnome-terminal is now __50__ times faster than it was 5 month ago.
> >>
> >> Matthias
> > 
> > Well, here are some comparisons done with my test-prog (attached)
> > (higher is better):
> > 
> > eterm:                      ~ 14 000 l/s
> > xterm:                      ~  8 500 l/s
> > gnome-terminal:             ~  3 500 l/s
> > frame-buffer:               ~     40 l/s
> 
> Om my (slow?) laptop I get:
> 
> frame-buffer:      34 l/s
> rxvt-unicode:      12 000 l/s
> xterm:             4500 l/s
> Konsole:           6666 l/s
> gnome-terminal:    6666 l/s
>                    ^^^
>                 _not_ faked :)
> 
Maybe this has something to do with your screen resolution; as you are
using a 'slow' laptop, i guess you are using 1024x768, while i use
1280x1024 in my athlon-xp 2400+.

PS: Did you pass any values to the prog ? It's because, it stopps after
it has written 20 000 lines if no arguments are passed. For very fast
terminals this is bad; Imagine a terminal that puts out 11 000 lines per
second. It will then take about 1.8 s to write 20 000 lines. However,
the program uses time(...) and therefore it will write:
20 000 l/s. The '6666' is not a big surprise, because 20 000 / 3 =
6666.7. Thus, if your terminal needs from 3s to 4s for 20000 lines, you
will always get this result if specifying no arguments. As i said before
this is just a quick hack to make some comparisons. However, here is a
slightly impoved version ...


#include <cmath>
#include <ctime>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

static string 
rStr("AaBbCcEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz(){}[]?*+-/_-:.;,                                       ");

int main(int argc, char **argv)
{
	int lines;
	if(argc == 1)
		lines = 20000;
	else if(argc == 2)
	{
		lines = atoi(argv[1]);
		if(lines < 1000)
		{
			cerr << "Please enter at least '1000' for lines !" << endl;
			return 1;
		}
	}
	else
	{
		cerr << "Usage: tspeed <lines>" << endl;
		return 2;
	}
	time_t t1 = time(NULL);
	for(int i=0; i != lines; ++i)
	{
		cout << rStr << endl;
		random_shuffle(rStr.begin(), rStr.end());
	}
	time_t t2 = time(NULL);
	time_t elapsed = t2-t1;
	if(elapsed == 0)
	{
		cerr << endl;
		cerr << "Writing " << lines << " lines to the screen took less than one second." << endl;
		cerr << "Please choose a bigger value for lines." << endl;
		return 3;
	}

	double speed = double(lines)/double(elapsed);

	if(elapsed < 6)
	{
		cout << endl;
		cout << "Warning: writing " << lines << " lines took fewer than 6 seconds." << endl;
		cout << "The the results may be inaccurate." << endl;
		cout << "Try tspeed <value> with value > " << ceil(6*speed) << endl;
	}

	cout << endl;
	cout << "terminal speed: " << floor(speed) << " l/s" << endl;
	return 0;
}
	

Reply via email to