Results 1 to 10 of 16

Thread: String handling issue with Free Pascal

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    I actually needed to look up how multithreading exactly works in Pascal. And I still don't get half of it, so that will take some time. Keep in mind I've hardly ever used objects in my programs, only simple ones. This TThread class is a mess compaired to them.

    I've deleted the part of the program where it writes out every try, now it just outputs the result, and it is a lot faster now. At 5 character length it still seems unexplainably slow(I haven't tried with more). This multithreading seems like something that could work but I need to study it further before I can implement it in my program.

  2. #2
    If you would want to optimize it a bit, i would first get rid of NextChar() function. You could put all valid characters in a string constant, something like
    Code:
    const validstr = 'abcd....ABCD....XYZ0123456789';
    Then matter of changing character is simply increasing character index by 1.

    Code:
    index:=1;
    validstr[index] is 'a'
    inc(index);
    validstr[index] is now 'b'

  3. #3
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2
    Quote Originally Posted by Sogcelak View Post
    I actually needed to look up how multithreading exactly works in Pascal. And I still don't get half of it, so that will take some time. Keep in mind I've hardly ever used objects in my programs, only simple ones. This TThread class is a mess compaired to them.

    I've deleted the part of the program where it writes out every try, now it just outputs the result, and it is a lot faster now. At 5 character length it still seems unexplainably slow(I haven't tried with more). This multithreading seems like something that could work but I need to study it further before I can implement it in my program.
    I have a tutorial that covers the basics of multi-threading.
    :: AthenaOfDelphi :: My Blog :: My Software ::

Bookmarks

Posting Permissions

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