Announcement

Collapse
No announcement yet.

How to search faster?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Edwin Knoppert
    replied
    The marshalling aspect, did you ever done that?

    ------------------
    [email protected]

    Leave a comment:


  • Semen Matusovski
    replied
    florent tried to compared http://www.powerbasic.com/support/pb...ead.php?t=2746
    speed - maybe a little faster.
    i can name a lot of arguments, for example, msdn de-facto also recommends cotask: "the cotaskmemalloc function has the advantage of working well in either c, c++, or visual basic. it is also the only way to share memory in a com-based application, since midl uses cotaskmemalloc and cotaskmemfree to marshal memory.".
    but a real reason is - more comfortable than heap.

    ------------------
    e-mail: [email protected]

    Leave a comment:


  • Edwin Knoppert
    replied
    Well, i have to figure this one out too.
    It looks as complex as my question about dynamic strings..
    But it might indeed be solved by using a simple string ptr.

    But why do you use the 'CoTaskMemAlloc' api?
    Is this one faster or so?

    Thanks,



    ------------------
    [email protected]

    Leave a comment:


  • Semen Matusovski
    replied
    Edwin --
    Pb Instr works fine.
    If you will locate a "length" field before string data and will create fictive String Ptr, you can full PB.

    Code:
       #Compile Exe
       #Dim All
    
       Declare Function CoTaskMemAlloc Lib "ole32.dll" Alias "CoTaskMemAlloc" (ByVal Dword) As Dword
       Declare Sub CoTaskMemFree Lib "ole32.dll" Alias "CoTaskMemFree" (ByVal Dword)
    
       Function PbMain
    
          %nLen = 100000
          
          Dim hMem As Dword Ptr
    
          hMem = CoTaskMemAlloc(%nLen + 9)
    
          @hMem = hMem + 8
          @hMem[1] = %nLen
    
          Local pS As String Ptr
          pS = hMem
          
          MsgBox "Addr = " + "&H" + Hex$(StrPtr(@ps)) + " Len =" + Str$(Len(@ps)),, "Compare with next step"
          
          Lset @ps = "This is a test"
          
          MsgBox "Addr = " + "&H" + Hex$(StrPtr(@ps)) + " Len =" + Str$(Len(@ps)),, "Should be the same"
          
          MsgBox "Instr =" + Str$(Instr(@ps, "test"))
          
          CoTaskMemFree hMem
    
       End Function
    ------------------
    E-MAIL: [email protected]

    [This message has been edited by Semen Matusovski (edited December 18, 2000).]

    Leave a comment:


  • Edwin Knoppert
    started a topic How to search faster?

    How to search faster?

    I need a faster instr() preferably an asm procedure because of our own created mem. blocks.

    We have strings with unique string id's.
    We need a very fast lookup method.


    ??


    ------------------
    [email protected]
Working...
X