From owner-freebsd-hackers@FreeBSD.ORG Fri May 20 23:08:46 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F113D16A4CE for ; Fri, 20 May 2005 23:08:46 +0000 (GMT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8B5C343D83 for ; Fri, 20 May 2005 23:08:46 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.3) id j4KN8kJj092688; Fri, 20 May 2005 18:08:46 -0500 (CDT) (envelope-from dan) Date: Fri, 20 May 2005 18:08:45 -0500 From: Dan Nelson To: alexander Message-ID: <20050520230845.GC51092@dan.emsphone.com> References: <20050520224726.GA7951@skatecity> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050520224726.GA7951@skatecity> X-OS: FreeBSD 5.4-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.9i cc: freebsd-hackers@freebsd.org Subject: Re: Looking for ANSI/VT100 code replacement. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 May 2005 23:08:47 -0000 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