Results 1 to 13 of 13

Thread: SEARCHING code

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    8

    Smile Re: SEARCHING code

    all ok.
    thank a lot
    peppos

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: SEARCHING code

    900 million numbers? How big is the .txt file in size?

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    8

    Re: SEARCHING code

    Often is 40 or 60 mega on hard disk.
    Actually I am using this code in BBC Basic but is slow for searching:


    PO= 4
    B1%(K%,0) B1%(K%,1) B1%(K%,2) B1%(K%,3) B1%(K%,4) (chaine in the file)
    rem : PO is the quantity of number to be searched in the file containing 500.000 until 900.000 chaines



    a%() = 222, 112, 234, 900, 111 rem my chaine to be searched

    FOR K% = 1 TO 900000
    N% = 0
    FOR I% = 0 TO 4
    FOR J% = 0 TO 4
    IF a%(I%) = B1%(K%,J%) N% += 1
    NEXT
    NEXT
    IF N% >= PO PRINT B1%(K%,0) B1%(K%,1) B1%(K%,2) B1%(K%,3) B1%(K%,4) ;" ";KKK; " POS. ";K%


    80 NEXT K%

    Thanks for a reply
    Peppos

  4. #4
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: SEARCHING code

    If you want a major speed increase then byte arrays is the way to go...

    Easiest way with using byte arrays is to load the whole file into an array and search through that. Having a 40-60MB file in RAM is a lot, but for most modern computers it's not asking too much...the algorithm can always be rewritten to work with chunks of the file at a time...

    Here is an example. To see how fast it really is, compile it to an EXE first and then run it. When it loads, select your file. Then enter the numbers in the textbox exactly as they appear in the file and click GO.
    Attached Files Attached Files

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    8

    Re: SEARCHING code

    Thanks a lot for your reply. You are a kindly and well disposed person, God help you always !

    I am not skilled to transform your code in .exe. Perhaps becauseI have an
    old VB.
    However I already have put the data in array, (cutting the quantity), but the speed increase a few.
    Can you make for me your code and sent the code in exe? I thank you much.
    Otherwise you can recommend me to purchase a computer more speed.?
    But what ?. Someone has advised a PC with Vista with 8 giga Ram (HP). As your experience is good for my studies and my research ? Can really obtain more speed ? Or can you counsel other ?
    Thanks ,Thanks
    Giuseppe Villamaina
    Peppos from Italy (Naples)

  6. #6
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: SEARCHING code

    Here's a zip with the compiled EXE...

    Also, are you using VB6? (not Learning Edition). You should be able to go to File menu -> Make EXE to compile the code into an EXE file. You don't need a fast computer to do this...
    Attached Files Attached Files

  7. #7

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    8

    Smile Re: SEARCHING code

    hello, thanks.
    When I run your .exe the program tell me " Not in use the COMDLG32.OCX"
    Now I try to have this COM..... and I'll write to you as soon as possible.
    Probably I have old version VB 5 , for this reason does'nt function.
    I'll try a new version.

    Thanks and best regards
    Giuseppe

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width