New topic: 

Searching in an array - speed question

<http://forums.realsoftware.com/viewtopic.php?t=44815>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        relaht          Post subject: Searching in an array - speed 
questionPosted: Mon Jul 23, 2012 3:10 pm                         
Joined: Fri Dec 01, 2006 9:39 pm
Posts: 156                I have an array of a custom class. (This class holds 
many Properties and Methods.)
Let's call it MyClassArray()
This array holds more than 15.000 items 

Now I need to search this array for a Property.

This is how I do it now:
Function getMyClass(Search As String) As myClass
  Dim i As Integer
  
  For i = 0 to MyClassArray.Ubound
  
  If InStr( MyClassArray.Name, Search ) > 0 Then Return MyClassArray( i )
  
  Next
End Function


It works good, but is much to slow.

I was thinking to build a Dictionary from this array, but from my 
understanding, that will only work, if the search string exactly mach the 
Property!?!

Any other idear how I can speed up this?   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to