[TUHS] termcap vs terminfo (was: I swear! I rtfm'ed)
Mary Ann Horton
mah at mhorton.net
Fri Jan 2 11:50:25 AEST 2015
Quoting Warner Losh <imp at bsdimp.com>:
>>
>>> But the big motivator was performance. Reading in a termcap entry from
>>> /etc/termcap was terribly slow. First you had to scan all the way
>>> through the (ever-growing) termcap file to find the correct entry. Once
>>> you had it, every tgetstr (etc) had to scan from the beginning of the
>>> entry, so starting up a program like vi involved quadratic performance
>>> (time grew as the square of the length of the termcap entry.) The VAX
>>> 11/780 was a 1 MIPS processor (about the same as a 1 MHz Pentium) and
>>> was shared among dozens of timesharing users, and some of the other
>>> machines of the day (750 and 730 Vaxen, PDP-11, etc.) were even slower.
>>> It took forever to start up vi or more or any of the termcap-based
>>> programs people were using a lot.
>>
>> Hum. That seems like it would be more of an implementation issue.
>> Why wouldn't you just cache all the entries for the terminal once
>> and for all? terminfo never came to 16-bit systems anyway, so we're
>> talking about systems with plenty of memory. Caching the terminal
>> information would not be a big memory cost.
>
> BSD solved this problem that way: parse /etc/termcap and put all the
> entries into termcap.db. :)
That's essentially what terminfo's binary files are: a parsed, cached
version of the source.
More information about the TUHS
mailing list