From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 8 16:51:48 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AFE7A3E9; Mon, 8 Dec 2014 16:51:48 +0000 (UTC) Received: from chez.mckusick.com (chez.mckusick.com [IPv6:2001:5a8:4:7e72:4a5b:39ff:fe12:452]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8FA1AD1D; Mon, 8 Dec 2014 16:51:48 +0000 (UTC) Received: from chez.mckusick.com (localhost [127.0.0.1]) by chez.mckusick.com (8.14.3/8.14.3) with ESMTP id sB8GpbpO088722; Mon, 8 Dec 2014 08:51:37 -0800 (PST) (envelope-from mckusick@chez.mckusick.com) Message-Id: <201412081651.sB8GpbpO088722@chez.mckusick.com> To: Garrett Cooper Subject: Re: Reason for reordering /usr/share/misc/termcap.src for /usr/share/misc/termcap ? In-reply-to: <20141208131340.16934twbkxmadd6c@webmail.uu.se> Date: Mon, 08 Dec 2014 08:51:37 -0800 From: Kirk McKusick X-Mailman-Approved-At: Mon, 08 Dec 2014 17:31:14 +0000 Cc: FreeBSD Hackers , Erik Trulsson , dickey@his.com, jkh@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Dec 2014 16:51:48 -0000 > Date: Mon, 08 Dec 2014 13:13:40 +0100 > From: Erik Trulsson > To: Garrett Cooper > Cc: FreeBSD Hackers , > Kirk McKusick , jkh@freebsd.org, > dickey@his.com > Subject: Re: Reason for reordering /usr/share/misc/termcap.src for /usr/share/misc/termcap ? > X-ASK-Info: Message Queued (2014/12/08 04:13:49) > X-ASK-Info: Confirmed by User (2014/12/08 08:34:35) > > Quoting Garrett Cooper : > >> Hi all, >> I'm trying to resolve an issue where usr.bin/vi is needed to >> preprocess share/termcap every time make buildworld is invoked on >> FreeBSD. The termcap file reordering seems to have been done since >> the BSD 4.4 Lite sources were imported into FreeBSD: >> https://svnweb.freebsd.org/base/projects/building-blocks/share/termcap/Makefile?view=markup#l15, >> https://svnweb.freebsd.org/base?view=revision&revision=1638. >> I don't have history behind why this should be done (it's unfortunate >> because it appears to mangle the comment <-> entry mappings, and >> ultimately this gets put into termcap.db), and I was hoping that >> someone with additional history could fill in why this is being done. >> Thank you! > > It looks like it is done to put the most common (at the time it was > written) terminal types early in the reordered termcap file. This > presumably so that programs reading termcap would be more likely to > find the entry they wanted as quickly as possible. > > That would have been useful when termcap was just a plain text file, > but if you are using termcap.db to look up terminal capabilities then > there doesn't seem to be much point to doing such reordering beforehand. I believe Erik Trulsson's answer is correct. Termcap had grown very large and on sub-1-MIP computers took a noticable delay to read on every startup of programs using it. So, it was reordered to reduce the startup time on common terminals. As Erik points out this optimization is no longer necessary as termcap is now placed in a database. Not to mention that there are far fewer entries in it today than there were at the peak of its existence. Kirk McKusick