From 4f5108d3edb20e0466c0447dcc9a5b4a49267ba6 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Mon, 6 Jan 2014 22:39:25 +0000 Subject: 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). --- man_validate.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'man_validate.c') diff --git a/man_validate.c b/man_validate.c index 2c64608c..8ab5c2c5 100644 --- a/man_validate.c +++ b/man_validate.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2010, 2012, 2013 Ingo Schwarze + * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze * * 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(""); -- cgit