Jump to content

julkas

Members
  • Content Count

    44
  • Joined

  • Last visited

Posts posted by julkas


  1. Delphi 10.3 Community Edition

    $ dcc32 --version
    dcc (Embarcadero Delphi for Windows) 33.0
    Embarcadero Delphi for Win32 compiler version 33.0
    Copyright (c) 1983,2018 Embarcadero Technologies, Inc.
    
    $ dcc64 --version
    dcc (Embarcadero Delphi for Windows) 33.0
    Embarcadero Delphi for Win64 compiler version 33.0
    Copyright (c) 1983,2018 Embarcadero Technologies, Inc.
    
    
    

     


  2. 22 hours ago, Mike Torrettinni said:

    That is interesting. Do you use it, for what cases you prefer using it?

     

    I can't find Delphi implementation. Do you know does it exist?

    There is no ready to use Pascal implementation 😞 . You can start / take ideas from existing C++ & Java code and create good (without remove/delete 😞) ordered set or order statistics set (array bisection algorithm may be helpful) Object Pascal class.


  3. On 3/6/2021 at 2:32 PM, Mike Torrettinni said:

    I'm refactoring usage of various different look-up tables and I'm trying to come with 1 fast look-up table design. Most of them have 1 thing in common: search by integer (ID) and search by string (Name).

    All data is sorted.

     

    So, I bench-marked TArray.BinarySearch, TDictionary and custom binary search.

    Even though a flaw in design was pointed out for TArray.BinarySearch, (see https://en.delphipraxis.net/topic/4575-why-is-tarraybinarysearch-slower-than-normal-binary-search-function/), I still wanted to compare results:

     

    For search by integer, custom binary search seems to be a little faster than TDictionary, until large tables:

    image.png.67388e6df369cfce9ae31490179558c9.png

     

    For search by string, custom binary search wins even more, still for not large tables:

    image.png.50244b99e8133d6704d0554f0f020b16.png

     

    Interesting is that for smaller searches, 10 records, a sequential search is faster than TDictionary.

     

    I also tried TGpStringHash (by Primoz Gabrielcic), which is very fast, but unfortunately no implementation for integers.

    TSynDictionary (from mORMot) is also very fast, but I don't use mORMotand license is not friendly for my commercial project.

     

    Is there any other fast search implementations that is not too specialized and ready to use out of the box, that I can try?

     

     

     

     

    Take a look - Binary Array Set. Rare, but very useful data structure.

    • Thanks 1

  4. On 4/28/2021 at 10:28 AM, Tommi Prami said:

    Could someone point into nice implementation?

    Would be nice (but not 100% necessary) that would have similar functionality than RTL version have. More than less drop in replacement (Easy to port)

     

    -Tee-

    OK, it depends. Anyway, I suggest - xoshiro / xoroshiro generators

    Or 🙂 start with simple SplitMix64

    Efficiently Generating a Number in a Range


  5. 2 hours ago, David Heffernan said:

    Can it play chess well? Or is it interesting because it's Pascal? 

    It's old chess engine written in Turbo Pascal.

    It's good for beginners and not only. You can increase / decrease engine default thinking time with + / -. Executable created on Windows 10 with Delphi Community Edition is in the folder Delphi. 

    So just enjoy chess and power of great Turbo Pascal.

    I think it's clear.


  6. 6 hours ago, Marat1961 said:

    Where will your code in the procedure be faster than the same code generated by the compiler.

    As far as I understand, the functionality of the code is the same, but the overhead of calling the procedure is added.

    As a result, if we calculate everything, we lose in performance.

    Thanks all for replies.

    Please see question - https://www.quora.com/What-are-the-10-biggest-prime-numbers-below-2-64

    Here is my last solution  - https://ideone.com/oO83MV

     

    Can you do it faster using only Miller Rabin test?

    If - yes,, provide your solution.

     

    BTW - My pure Object Pascal implementation is here - https://github.com/JulStrat/primesieve-pas/blob/mult/mult/modar.pas

     

×