Date: Mon, 10 Feb 2003 13:03:07 +0100 From: Dag-Erling Smorgrav <des@ofug.org> To: www@freebsd.org Subject: query-pr.cgi patch Message-ID: <xzplm0ony10.fsf@flood.ping.uio.no>
next in thread | raw e-mail | index | archive | help
--=-=-= Since we don't honor the "Confidential" setting in PRs, there's no point in having query-pr.cgi check for it. The attached patch should considerably reduce (by about half) the amount of processing required to look up a PR. A further improvement would be to seach the PR database directly for the specified PR, without using query-pr(1). The reason for this is that query-pr(1) reads the index, which is currently approaching 10 MB and is sorted chronologically (so recent PRs, which are more likely to be requested, are near the end). Searching the database directly would require at most 16 directory lookups (one for each category) to locate the PR, instead of: des@des ~% time ktrace query-pr 46335 >/dev/null ktrace query-pr 46335 > /dev/null 0.72s user 1.06s system 49% cpu 3.601 total des@des ~% kdump | grep -A2 adm/index 20764 query-pr NAMI "/usr/local/share/gnats/gnats-db/gnats-adm/index" 20764 query-pr RET open 3 20764 query-pr CALL stat(0x805f400,0xbfbff500) 20764 query-pr NAMI "/usr/local/share/gnats/gnats-db/gnats-adm/index" 20764 query-pr RET stat 0 20764 query-pr CALL fstat(0x3,0xbfbff450) des@des ~% kdump | grep -c 'fd 3 read' 559 DES -- Dag-Erling Smorgrav - des@ofug.org --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=query-pr.diff Index: en/cgi/query-pr.cgi =================================================================== RCS file: /home/ncvs/www/en/cgi/query-pr.cgi,v retrieving revision 1.29 diff -u -r1.29 query-pr.cgi --- en/cgi/query-pr.cgi 5 Aug 2002 19:05:29 -0000 1.29 +++ en/cgi/query-pr.cgi 10 Feb 2003 11:46:20 -0000 @@ -56,7 +56,7 @@ exit 0; } -unless (open(Q, "query-pr --restricted -F $pr 2>&1 |")) { +unless (open(Q, "query-pr -F $pr 2>&1 |")) { print &html_header("Server error"); print "<p>Unable to open PR database.</p>\n"; print &html_footer; @@ -87,8 +87,6 @@ print "<PRE>$_\n"; print <Q>; print "</PRE>\n"; - } elsif (($* = 1) && `query-pr $pr 2>&1` =~ /^>Confidential:\s+yes/) { - print "<P>Sorry, PR $pr exists but is confidential\n"; } else { print "<p>No PR found matching $pr\n"; } --=-=-=-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-www" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzplm0ony10.fsf>