Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Sep 21, 2019 1:39 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Folderitems and Realstudio 2011 R 4 slowdown
PostPosted: Sat Jan 07, 2012 1:16 pm 
Offline

Joined: Sun Jul 18, 2010 9:17 am
Posts: 23
Location: Germany, duesseldorf
Hi , i have a Problem with 2011 R4 . I have written a routine, which recursivly retrieves all files on a harddisc or in x folders. Everything works fine with Realstudio before R4 ... After i changed my environment to R4 - the Routine significally slows down . I tracked it down to folderitem.trueitem which IS 40% slower as in R3. You do not recognize this if you only have 300 or 500 Files / Folders , but it bring's me into trouble if my clients retrieve about 40000 files on a drive.
Anybody experienced the same problem ? Any solutions ?
THX
Thomas

Software runs on MacOS Lion and SnowLeopard ( Same Speed Problem )


Top
 Profile  
Reply with quote  
 Post subject: Re: Folderitems and Realstudio 2011 R 4 slowdown
PostPosted: Sat Jan 07, 2012 1:32 pm 
Offline
User avatar

Joined: Sat May 27, 2006 3:27 pm
Posts: 480
thomas wrote:
Hi , i have a Problem with 2011 R4 . I have written a routine, which recursivly retrieves all files on a harddisc or in x folders. Everything works fine with Realstudio before R4 ... After i changed my environment to R4 - the Routine significally slows down . I tracked it down to folderitem.trueitem which IS 40% slower as in R3. You do not recognize this if you only have 300 or 500 Files / Folders , but it bring's me into trouble if my clients retrieve about 40000 files on a drive.
Anybody experienced the same problem ? Any solutions ?
THX
Thomas

Software runs on MacOS Lion and SnowLeopard ( Same Speed Problem )


Try using windows declares works faster then built in window search.

Soft Declare Function FindFirstFileW Lib "Kernel32" ( path as WString, data as Ptr ) as Integer
Soft Declare Function FindNextFileW Lib "Kernel32" ( handle as Integer, data as Ptr ) as Boolean
Declare Sub FindClose Lib "Kernel32" ( handle As Integer )


Top
 Profile  
Reply with quote  
 Post subject: Re: Folderitems and Realstudio 2011 R 4 slowdown
PostPosted: Sat Jan 07, 2012 2:11 pm 
Offline

Joined: Sun Jul 18, 2010 9:17 am
Posts: 23
Location: Germany, duesseldorf
I do not need a search function nor runs The software on Windows . I have to retrieve every filename on SAN systems with MacOSX clients attached. No need to search for a special filepattern or something like that. But THX for the answer


Top
 Profile  
Reply with quote  
 Post subject: Re: Folderitems and Realstudio 2011 R 4 slowdown
PostPosted: Sat Jan 07, 2012 2:27 pm 
Offline
User avatar

Joined: Sat May 27, 2006 3:27 pm
Posts: 480
something like this?

Function FilePattern(f as folderitem) as boolean
dim s(),n as string
s = Array("jpg","txt","xml")
n=f.name
if instr(n,".")=0 then
return false
else
return( s.indexof( NthField(n ,".",CountFields(n,".") ) ) > -1 )
end
end


Top
 Profile  
Reply with quote  
 Post subject: Re: Folderitems and Realstudio 2011 R 4 slowdown
PostPosted: Sat Jan 07, 2012 3:05 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
thomas wrote:
Hi , i have a Problem with 2011 R4 . I have written a routine, which recursivly retrieves all files on a harddisc or in x folders. Everything works fine with Realstudio before R4 ... After i changed my environment to R4 - the Routine significally slows down . I tracked it down to folderitem.trueitem which IS 40% slower as in R3. You do not recognize this if you only have 300 or 500 Files / Folders , but it bring's me into trouble if my clients retrieve about 40000 files on a drive.
Anybody experienced the same problem ? Any solutions ?
THX
Thomas

Software runs on MacOS Lion and SnowLeopard ( Same Speed Problem )


Really depend on how you iterate over your folder items
If you do
for i as integer = folder.Count downto 1
process( folder.item(i) )
next

you will find this IS much slower

If you do
for i as integer = 1 to folder.Count
process( folder.item(i) )
next

you'll be much quicker
This is a result of a change to use the newer API's in OS X that make iterating forwards MUCH faster than backwards

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Folderitems and Realstudio 2011 R 4 slowdown
PostPosted: Sat Jan 07, 2012 4:33 pm 
Offline

Joined: Sun Jul 18, 2010 9:17 am
Posts: 23
Location: Germany, duesseldorf
Hi Norman ,
Yes! This is it! I count down after i changed my code to iterate up it IS much faster.
THX Thomas


Top
 Profile  
Reply with quote  
 Post subject: Re: Folderitems and Realstudio 2011 R 4 slowdown
PostPosted: Sun Jan 08, 2012 9:32 am 
Offline

Joined: Sun Jul 18, 2010 9:17 am
Posts: 23
Location: Germany, duesseldorf
After i checked it all in a real environment - Things slow down again.


dim count as Integer = folder.Count
dim fx as folderitem

for i as Integer = 1 to count

if folder.trueItem( i ) <> nil then

fx = folder.trueItem( i )

// directory or not
if fx.Directory then
GetFilesinFolderA( fx, farray)
end if

// process - if it is not a system thing
if fx.name <> "" and left(fx.name,1) <> "." then
if not fx.Directory then
farray.Append fx
end if
end if


end if

next i


The name of the routine is "GetFilesInFolderA (folder As Folderitem,fArray() As folder item) - so if it is a directory it calls itself.
You get all files on a drive , even it is in a folder or not.

If i run this routine in a small program on RB2011R4 everything works ok. If i call this from a Thread .... it the time consumption is horrible.
Any ideas ?

THX Thomas


Top
 Profile  
Reply with quote  
 Post subject: Re: Folderitems and Realstudio 2011 R 4 slowdown
PostPosted: Sun Jan 08, 2012 10:15 am 
Offline
Real Software Engineer

Joined: Fri Jan 28, 2011 5:24 pm
Posts: 145
thomas wrote:
for i as Integer = 1 to count
if folder.trueItem( i ) <> nil then
fx = folder.trueItem( i )


Don't call TrueItem() multiple times. Instead, cache the item you get back into a variable and use that for everything. <feedback://showreport?report_id=19551>

_________________
Joe Ranieri
Mac Frameworks & Compiler
REAL Software, Inc.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group