X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Message-ID: <4A9DC5FC.2070202@byu.net> Date: Tue, 01 Sep 2009 19:10:20 -0600 From: Eric Blake User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: struct dirent.d_reclen References: <20090901233750 DOT GA32145 AT ednor DOT casa DOT cgf DOT cx> In-Reply-To: <20090901233750.GA32145@ednor.casa.cgf.cx> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Christopher Faylor on 9/1/2009 5:37 PM: > Maybe you mean d_namlen? Yes; serves me right for confusing readdir(2) and readdir(3) man pages. > It is not a given that adding d_reclen would speed anything up since it > cause every single program that uses dirent to effectively perform a > strlen on every record returned by readdir whether it needed that field > or not. Not so. For example, fhandler_disk_file::readdir_helper is already doing a sys_wcstombs to populate the d_name buffer, and that returns the length as a side effect. In other words, the cost of providing the length to the client is an O(1) single assignment of an already-existing value per entry (and when you consider that we are already assigning __d_unused1 to 0, that means no net increase in cost to clients that don't care about the length); whereas the current situation requires clients that care about the length to use O(n) strlen() and duplicate something that was previously calculated by cygwin1.dll. - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9 AT byu DOT net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkqdxfwACgkQ84KuGfSFAYC25wCgukOyTo5JpQ5c1wMk2HhpcJtD MrUAn2qUnrv2+w4SsGjf6BKzjawc6ndA =q8gE -----END PGP SIGNATURE----- -- 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