realbasic-nug
[Top] [All Lists]

Re: FolderItem.delete Oddities?

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: FolderItem.delete Oddities?
From: Thomas Tempelmann <tempelmann@gmail.com>
Date: Tue, 31 Mar 2009 21:40:03 +0200
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com; dkim=neutral (body hash did not verify) header.i=@gmail.com
Delivered-to: listarchive@realsoftware.com
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=q7OPezUlZPBmz4miBJJ/txwCJbjhK4+cSZCkIG23V1c=; b=dKPTOl+q9h+F8Mtq6gc6fWaoYpkfxACCr67iMy7HGbutbUd6+9EoQ9OdxChQO0b9yU ZUlB02nbbjjnMqwysaqiCuoTOpai+XBaEBd+S0TjNqSnqWPwOtcsAy/Rz8tnh9r51UiB 3ucjgOHerMlOzEb1n/x3rZSsXiKqBz/U4ymac=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=TuLcKTiseKoSsoOUEvVDQSHrnr1f4ay+ltAe0o4F0M5vGUZxRoTIu9HMoDbct/J/kq Qk7XlPdJ1Pr2/UwdLhtSFpxyduYHHJfL4ZHTkjIC+RoGvjbTfWkvUnnEnJ7m5yywh+Wq 8rSr5Cg6/Wku3EGKGkvZyguXK6NCYIyEK0mpY=
In-reply-to: <E7631244-FE97-4299-BC4A-79EDF81E8393@online.de>
References: <382799.72156.qm@web65614.mail.ac4.yahoo.com> <A0B9E68F-F447-4291-9727-E72D8648E1B4@online.de> <58031FB4-BB70-45EC-B698-FBB7998DC783@mac.com> <E7631244-FE97-4299-BC4A-79EDF81E8393@online.de>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
On Tue, Mar 31, 2009 at 21:13, Christian Dorn <realbasic@online.de> wrote:
>>
>> What change can prevent deleting in an order rather than
>> another order?
>
> Charles, can you provide us with some background, why a downto-loop is
> slower than a to-loop in this case?

Actually, I am the expert on this (I actually wrote the current code
that RB's framework uses on the Mac for this):

The old Mac OS API to read a directory supported to index any item in
the dir at the same speed. The new code that RB now uses, supports
only a forward iteration over the directory.

Hence, if you read the items backwards one by one, it has to read all
items before it each time, and it can't cache them easily.

Only when you iterate forward, the RB code uses a tiny cache to
remember which item it looked up last, and if the next looked-up one
is the next index, it uses the OS function efficiently without
re-reading the entire dir from start.

Since the same rule (forward lookup faster than reverse) has always
been true for Windows and Linux because those OS never had the fast
direct-indexed lookup as the old OS API did, there's not much sense it
making a big effort in keeping to support this old way by adding
"smart" caching which only possibly lead to new problems. Instead, we
decided to encourage to use only forward-iteration now, which is the
best solution for all platforms now.

Good enough of an explanation?

-- 
Thomas Tempelmann, http://www.tempel.org/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>