diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-01-06 22:39:25 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-01-06 22:39:25 +0000 |
commit | aa902148c80402b742b1e9a00236c3094b044a2b (patch) | |
tree | 903f52a5aa3078c4aca3de49974dc9a29c807b78 | |
parent | 5856944693ea231656e42d7ac30d26149f53a66a (diff) | |
download | mandoc-aa902148c80402b742b1e9a00236c3094b044a2b.tar.gz mandoc-aa902148c80402b742b1e9a00236c3094b044a2b.tar.zst mandoc-aa902148c80402b742b1e9a00236c3094b044a2b.zip |
Another 18% speedup for mandocdb(8) -Q, found by gprof(1).
In -Q mode, refrain form validating and normalizing the format
of the date given in .Dd or .TH, as it won't be used anyway.
For /usr/share/man, mandocdb -Q now takes 45% of the time of makewhatis(8).
-rw-r--r-- | man_validate.c | 14 | ||||
-rw-r--r-- | mdoc_validate.c | 12 |
2 files changed, 14 insertions, 12 deletions
diff --git a/man_validate.c b/man_validate.c index 479a05f1..ded50ba4 100644 --- a/man_validate.c +++ b/man_validate.c @@ -1,7 +1,7 @@ -/* $Id: man_validate.c,v 1.87 2013/12/31 18:07:42 schwarze Exp $ */ +/* $Id: man_validate.c,v 1.88 2014/01/06 22:39:25 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2010, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -211,8 +211,8 @@ check_root(CHKARGS) man->meta.title = mandoc_strdup("unknown"); man->meta.msec = mandoc_strdup("1"); - man->meta.date = mandoc_normdate - (man->parse, NULL, n->line, n->pos); + man->meta.date = man->quick ? mandoc_strdup("") : + mandoc_normdate(man->parse, NULL, n->line, n->pos); } return(1); @@ -435,8 +435,10 @@ post_TH(CHKARGS) if (n) n = n->next; if (n && n->string && '\0' != n->string[0]) { - man->meta.date = mandoc_normdate - (man->parse, n->string, n->line, n->pos); + man->meta.date = man->quick ? + mandoc_strdup(n->string) : + mandoc_normdate(man->parse, n->string, + n->line, n->pos); } else man->meta.date = mandoc_strdup(""); diff --git a/mdoc_validate.c b/mdoc_validate.c index 9053914a..bfd4d237 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,7 +1,7 @@ -/* $Id: mdoc_validate.c,v 1.199 2014/01/06 00:53:33 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.200 2014/01/06 22:39:25 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2010, 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org> * * Permission to use, copy, modify, and distribute this software for any @@ -2184,8 +2184,8 @@ post_dd(POST_ARGS) n = mdoc->last; if (NULL == n->child || '\0' == n->child->string[0]) { - mdoc->meta.date = mandoc_normdate - (mdoc->parse, NULL, n->line, n->pos); + mdoc->meta.date = mdoc->quick ? mandoc_strdup("") : + mandoc_normdate(mdoc->parse, NULL, n->line, n->pos); return(1); } @@ -2196,8 +2196,8 @@ post_dd(POST_ARGS) } assert(c); - mdoc->meta.date = mandoc_normdate - (mdoc->parse, buf, n->line, n->pos); + mdoc->meta.date = mdoc->quick ? mandoc_strdup(buf) : + mandoc_normdate(mdoc->parse, buf, n->line, n->pos); return(1); } |