Looking for ANSI/VT100 code replacement.
Dan Nelson
dnelson at allantgroup.com
Fri May 20 23:08:47 GMT 2005
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 at allantgroup.com
More information about the freebsd-hackers
mailing list