tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Kristaps Dzonsons <kristaps@bsd.lv>
To: tech@mdocml.bsd.lv
Subject: Re: Perfect hashes.
Date: Sun, 19 Jun 2011 15:24:22 +0200	[thread overview]
Message-ID: <4DFDF886.9050306@bsd.lv> (raw)
In-Reply-To: <4DDD69EF.3050008@bsd.lv>

On 05/25/2011 10:43 PM, Kristaps Dzonsons wrote:
> Hi,
>
> A while ago, Joerg brought up the idea of using perfect hashes for some
> of the keywords in mandoc. I'm reviving this conversation because I'd
> like a uniform interface for the roff, mdoc, man, chars, and mdoc-args
> tables. For the time being, each of these has its own method, which is
> error-prone, ugly, and bloated.
>
> Perfect hashes make sense because the above data is fixed. Furthermore,
> they have no cost of allocation and have little overhead in terms of
> unused table-space.
>
> Enclosed is a patch that implements this just for the mdoc macro names.
> I used gperf as I don't have a new NetBSD box handy for nbperf. (It
> doesn't matter which is used---I messed around with the generated code
> as it is.)
>
> The speed-up is a bit more than 1% when repeatedly running mandoc over a
> set of manuals. When running it with a large number of manuals on the
> command-line, the results are more or less the same. Either way, the
> generated binary is slightly smaller.
>
> I'm leaning toward implementing similar steps for all existing hash
> files. Does anybody have any objections? My intent in this isn't so much
> performance as uniform interfacing, code readability, correctness, and
> bloat. All of these are covered by perfect hashes, at the cost of
> needing an external utility whenever the symbols change.
>
> (I had to remove mdoc_macronames[] because there wasn't an immediate way
> to map back... I'll figure this out later, if nobody objects to the
> notion in the first place.)
>
> Thoughts?

Anybody?  I'm going to check in nbperf/gperf-constructed hashes for 
chars.c and the others if nobody speaks up...
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

  reply	other threads:[~2011-06-19 13:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25 20:43 Kristaps Dzonsons
2011-06-19 13:24 ` Kristaps Dzonsons [this message]
2011-06-21  0:11 ` Ingo Schwarze

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=4DFDF886.9050306@bsd.lv \
    --to=kristaps@bsd.lv \
    --cc=tech@mdocml.bsd.lv \
    /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).