> From [EMAIL PROTECTED] Fri Nov  3 14:30:04 2000
> Date: Fri, 3 Nov 2000 21:45:11 +0000 (GMT)
> From: Colin Bruce <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: LPRng: Scanning spool queues.
>
>
> Dear All,
>
> This is not at first sight anything to do with lprng but I hope it may
> generate an answer that will help the developers.
>
> I am writing a little program that needs to scan a spool queue for
> particular values. Pretty easy really. I've used fopen/fgets/fclose,
> open/read/close, open/mmap/close and so on. The thing is I can't make it
> go very fast. No surprise there really. With 3900 jobs in the queue I
> can get it down to somewhere between 0.6s and 30s. The wide variation is
> due to the kernel caching directory information I think.
>
> Now my programming problems are hardly of much interest to readers here
> but I guess the developers of lprng have similar problems. They need to
> be able to scan the queues and the faster the better. The thing is if
> I run grep (the GNU version) it never takes much more than a second to
> scan the same queue. Now I know that grep uses very clever and complicated
> searching mechanisms. That is not the problem. I am only scanning through all
> the files - I don't do any string comparisons with my little test program.
> How does grep manage to scan a large queue in times that vary from 0.5s
> to 1.1s. If anyone knows I would be most grateful and I guess Patrick
> would be too. I have looked at the sources for grep and it appears to
> use a combination of open/read/close and open/mmap/close. However, what
> it seems able to do is avoid the caching problem that I am experiencing
> and I notice lpd also experiences.
>
> Best wishes....
> Colin

In the next release you can use a GDBM file which holds all of the
contents of jobs.

You now open a file ONCE and then read it.

Patrick Powell                 Astart Technologies,
[EMAIL PROTECTED]            9475 Chesapeake Drive, Suite D,
Network and System             San Diego, CA 92123
  Consulting                   858-874-6543 FAX 858-279-8424 
LPRng - Print Spooler (http://www.astart.com)

-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address

If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------

Reply via email to