This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: get rid of getpwent? (Was: cygwin-1.7.28 getpwent header declaration changes ?)
- From: Warren Young <warren at etr-usa dot com>
- To: cygwin at cygwin dot com
- Date: Sat, 8 Feb 2014 08:39:23 -0700
- Subject: Re: get rid of getpwent? (Was: cygwin-1.7.28 getpwent header declaration changes ?)
- Authentication-results: sourceware.org; auth=none
- References: <52F339CA dot 5070305 at gmail dot com> <20140206090117 dot GD2821 at calimero dot vinschen dot de> <52F361C5 dot 3000807 at gmail dot com> <20140206141321 dot GI2821 at calimero dot vinschen dot de> <52F40208 dot 5030901 at etr-usa dot com> <20140207094917 dot GN2821 at calimero dot vinschen dot de> <52F53D7C dot 5050201 at etr-usa dot com> <52F553AA dot 9090500 at cygwin dot com> <52F561EE dot 8090806 at tiscali dot co dot uk> <52F56E92 dot 3070309 at cygwin dot com> <675717060 dot 20140208044040 at mtu-net dot ru> <C1264DEE-1D5E-4F08-8DB5-D62A0EA4DCC0 at etr-usa dot com>
On Feb 8, 2014, at 8:19 AM, Warren Young <warren@etr-usa.com> wrote:
> On Feb 7, 2014, at 5:40 PM, Andrey Repin <anrdaemon@yandex.ru> wrote:
>
>> In either case, repeatedly requesting the same record in a short amount of
>> time will only test the system level cache.
>
> If that were true, moving the requested record around in /etc/passwd wouldn’t cause a 6x spread in test results. That’s O(N) type behavior, whereas a cache approaches O(1).
A clarification:
I agree that /etc/passwd is being cached for the entire test. My 12-line file is a bit over 1K, so it fits easily into a 4K RAM page. Also, I repeated my tests several times, so even the initial disk read is cached.
The fact that we see a 6x speed difference depending on where in the file — or RAM page, if you prefer — the target record is tells us that lookups are dominated by parsing time.
Parsing overhead shouldn’t exist for SAM or AD. They’re “pre-parsed.”
The equivalent overhead in SAM/AD terms is tree and index traversal, which should happen a lot faster than O(N).
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple