The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: crossd@gmail.com (Dan Cross)
Subject: [TUHS] termcap vs terminfo
Date: Tue, 6 Jan 2015 11:56:42 -0500	[thread overview]
Message-ID: <CAEoi9W7Ke_AV8PjQ=i0kLK3PFUuXQBsFnR3a4A2hjqNTr88tJw@mail.gmail.com> (raw)
In-Reply-To: <54AC127A.5050508@update.uu.se>

On Tue, Jan 6, 2015 at 11:51 AM, Johnny Billquist <bqt at update.uu.se> wrote:

> On 2015-01-06 17:32, Mary Ann Horton<mah at mhorton.net> wrote:
>
>> Even with TERMCAP in the environment, there's still that quadratic
>> algorithm every time vi starts up.
>>
>
> I must be stupid or something. What quadratic algorithm?
> vi gets the "correct" terminal database entry directly from the
> environment. Admittedly, getting any variable out of the environment means
> a linear search of the environment, but that's about it.
>
> What am I missing? And once you have that, any operation still means
> either searching through the terminal definition for the right function,
> which in itself is also linear, unless you hash that up in your program.
> But I fail to see where the quadratic behavior comes in.


I believe that Mary Ann is referring to repeatedly looking up (presumably
different) elements in the entry.  Assuming that e.g. `vi` looks up O(n)
elements, where $n$ is the number of elements, doing a linear scan for
each, you'd end up with quadratic behavior.

Hashing, or storing in some kind of balanced-tree like structure or
something, would of course help but would also necessitate doing a copy and
would entail some additional memory inefficiency.

        - Dan C.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20150106/113d08c2/attachment.html>


  reply	other threads:[~2015-01-06 16:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.143.1420561935.3354.tuhs@minnie.tuhs.org>
2015-01-06 16:51 ` Johnny Billquist
2015-01-06 16:56   ` Dan Cross [this message]
2015-01-06 17:33     ` Johnny Billquist
2015-01-06 17:53       ` Dan Cross
     [not found] <1FD28B19-FA50-4581-BB0A-257B5DDE1890@kdbarto.org>
2015-01-10 22:15 ` [TUHS] Termcap " David Barto
2015-01-10 22:43   ` Lyndon Nerenberg
2015-01-10 22:51     ` Lyndon Nerenberg
2015-01-10 23:02     ` Christian Neukirchen
2015-01-10 23:04       ` Lyndon Nerenberg
2015-01-11 16:48         ` Christian Neukirchen
2015-01-11  2:06     ` Dave Horsfall
2015-01-11  9:16       ` Diomidis Spinellis
2015-01-12 15:36       ` Clem Cole
2015-01-06 21:32 [TUHS] termcap " Mary Ann Horton
  -- strict thread matches above, loose matches on Subject: below --
2015-01-01 17:04 [TUHS] termcap vs terminfo (was: I swear! I rtfm'ed) Warner Losh
2015-01-02 19:13 ` Erik E. Fair
2015-01-05  7:06   ` Peter Jeremy
2015-01-06  0:40     ` John Cowan
2015-01-06 12:22       ` arnold
2015-01-06 16:02         ` [TUHS] termcap vs terminfo Mary Ann Horton
2015-01-06 17:12           ` arnold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEoi9W7Ke_AV8PjQ=i0kLK3PFUuXQBsFnR3a4A2hjqNTr88tJw@mail.gmail.com' \
    --to=crossd@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).