Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 May 2005 18:08:45 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        alexander <arundel@h3c.de>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Looking for ANSI/VT100 code replacement.
Message-ID:  <20050520230845.GC51092@dan.emsphone.com>
In-Reply-To: <20050520224726.GA7951@skatecity>
References:  <20050520224726.GA7951@skatecity>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (May 21), alexander said:
> I'd like to port an application that was written in x86 assembly for
> Linux. So far all I had to do is change the Linux calling convention
> (registers) to Posix style (stack).
> 
> However at one point this application outputs 5 characters to stdout
> (using syscall write and fd=1). These 5 characters however are then
> being deleted and overwritten again. The application uses VT100 codes
> to do this.
> 
> First it moves the cursor to the left 5 times then it deletes
> everything from the end of the line to the current cursor position.
> 
> However this slows down the whole application. That's why I'd like to
> replace that code with something faster.

How often are you doing this?  I wrote a quick microbenchmark and my
pIII-900 box can do 80000 writes() per second of "\e[5D\e[Kabcde".  I
don't think that's your bottleneck.  If it is, the usual solution is to
not do a write on every iteration.  You've got a (maximum) 100hz screen
refresh rate anyhow, so doing more than 100 updates per second won't do
you any good.  Even 10 is probably more than you need.

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050520230845.GC51092>