Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 07/25/20 in all areas

  1. Pcre-Jit-Delphi Delphi wraps the PCRE library into the System.RegularExpressions unit. This unit provides a high-level, easy-to-use interface to PCRE. A limitation however is that it does not provide access to the Just-In-Time (JIT) compiler of PCRE. PCRE JIT can improve the performance of regular expression matching dramatically and is particularly useful, when you apply the same regular expression repetitively. The purpose of the Pcre-Jit-Delphi project is to patch the Delphi RTL in order to provide access to JIT. Please visit the project page at Github to see how you can use PCRE JIT in your projects. Benchmark The console project Benchmark.dpr in Demos folder compares the performance of the built-in Delphi regular expressions library, with the those of using Study without JIT and Study with JIT on a commonly used regular expression benchmark. Here are the results I got from the 64 bit version. Time | Match count ============================================================================== Delphi's own TRegEx: /Twain/ : 7.00 ms | 811 /(?i)Twain/ : 41.00 ms | 965 /[a-z]shing/ : 384.00 ms | 1540 /Huck[a-zA-Z]+|Saw[a-zA-Z]+/ : 461.00 ms | 262 /\b\w+nn\b/ : 588.00 ms | 262 /[a-q][^u-z]{13}x/ : 539.00 ms | 4094 /Tom|Sawyer|Huckleberry|Finn/ : 757.00 ms | 2598 /(?i)Tom|Sawyer|Huckleberry|Finn/ : 861.00 ms | 4152 /.{0,2}(Tom|Sawyer|Huckleberry|Finn)/ : 2615.00 ms | 2598 /.{2,4}(Tom|Sawyer|Huckleberry|Finn)/ : 2766.00 ms | 1976 /Tom.{10,25}river|river.{10,25}Tom/ : 455.00 ms | 2 /[a-zA-Z]+ing/ : 807.00 ms | 78423 /\s[a-zA-Z]{0,12}ing\s/ : 560.00 ms | 49659 /([A-Za-z]awyer|[A-Za-z]inn)\s/ : 789.00 ms | 209 /["'][^"']{0,30}[?!\.]["']/ : 321.00 ms | 8885 Total Time: 11963.00 ms ============================================================================== Delphi's own TRegEx with Study: /Twain/ : 6.00 ms | 811 /(?i)Twain/ : 41.00 ms | 965 /[a-z]shing/ : 316.00 ms | 1540 /Huck[a-zA-Z]+|Saw[a-zA-Z]+/ : 21.00 ms | 262 /\b\w+nn\b/ : 581.00 ms | 262 /[a-q][^u-z]{13}x/ : 413.00 ms | 4094 /Tom|Sawyer|Huckleberry|Finn/ : 28.00 ms | 2598 /(?i)Tom|Sawyer|Huckleberry|Finn/ : 217.00 ms | 4152 /.{0,2}(Tom|Sawyer|Huckleberry|Finn)/ : 2632.00 ms | 2598 /.{2,4}(Tom|Sawyer|Huckleberry|Finn)/ : 2785.00 ms | 1976 /Tom.{10,25}river|river.{10,25}Tom/ : 50.00 ms | 2 /[a-zA-Z]+ing/ : 759.00 ms | 78423 /\s[a-zA-Z]{0,12}ing\s/ : 563.00 ms | 49659 /([A-Za-z]awyer|[A-Za-z]inn)\s/ : 699.00 ms | 209 /["'][^"']{0,30}[?!\.]["']/ : 52.00 ms | 8885 Total Time: 9179.00 ms ============================================================================== Delphi's own TRegEx with JIT: /Twain/ : 11.00 ms | 811 /(?i)Twain/ : 14.00 ms | 965 /[a-z]shing/ : 12.00 ms | 1540 /Huck[a-zA-Z]+|Saw[a-zA-Z]+/ : 3.00 ms | 262 /\b\w+nn\b/ : 126.00 ms | 262 /[a-q][^u-z]{13}x/ : 154.00 ms | 4094 /Tom|Sawyer|Huckleberry|Finn/ : 22.00 ms | 2598 /(?i)Tom|Sawyer|Huckleberry|Finn/ : 61.00 ms | 4152 /.{0,2}(Tom|Sawyer|Huckleberry|Finn)/ : 277.00 ms | 2598 /.{2,4}(Tom|Sawyer|Huckleberry|Finn)/ : 346.00 ms | 1976 /Tom.{10,25}river|river.{10,25}Tom/ : 12.00 ms | 2 /[a-zA-Z]+ing/ : 84.00 ms | 78423 /\s[a-zA-Z]{0,12}ing\s/ : 156.00 ms | 49659 /([A-Za-z]awyer|[A-Za-z]inn)\s/ : 35.00 ms | 209 /["'][^"']{0,30}[?!\.]["']/ : 18.00 ms | 8885 Total Time: 1350.00 ms As you can see the increase in performance is impressive. Credits Many thanks to @Mahdi Safsafi who provided the assembly code for __chkstk and other Delphi developers (@Kas Ob., @David Heffernan, @Remy Lebeau, @Fr0sT.Brutal) that have provided useful advice.
  2. PeterPanettone

    Delphi 10.4 PATCH 2 experiences

    Get It offers the new Delphi 10.4 PATCH 2: Unfortunately, the installer (= downloader) does not explicitly mention the information that the installation has to be done MANUALLY. So, if you have not by chance visited the Embarcadero blog: https://community.idera.com/developer-tools/b/blog/posts/patch-2-for-rad-studio-10-4-now-available ...you would believe that PATCH 2 has been installed while it has not. OK, this file has to be executed: \Embarcadero\Studio\21.0\CatalogRepository\10.4Patch2pro-10\R104_Patch2Pro\patch2.bat Since the readme file says: "-The installation will require elevation...", I tried to execute the patch2.bat file with Administrator rights: But it seems that nothing happened after doing this. So I simply double-clicked the patch2.bat file. But no console window was shown to give me visual feedback of the executing patch. The only visual feedback was the HOURGLASS mouse-cursor which remained for over a minute. So I restarted the Delphi 10.4 IDE. In the About dialog, there was no mention of the installed patches 1 and 2. And since the readme file also says the AV bug in the License Manager would be fixed with this Patch 2, I opened the License Manager and ... had the same AV as before the Patch 2: I haven't also found any installation log file. Can anyone confirm this?
  3. Stefan Glienke

    Just-in-time compiling for Delphi's Regular Expressions

    RAD Studio Project - every Jira project has a unique code
  4. pyscripter

    Delphi 10.4 PATCH 2 experiences

    I had the same problem. I though I had installed the patch through Getit but it was not actually installed. After reading this thread I installed by the command prompt. It appears that just clicking on the bat file via the File Explorer did not work despite getting the elevation prompt.
  5. Rollo62

    Delphi 10.4 PATCH 2 experiences

    The backup files are there, in a separate folder, and also the file dates were changed as described in Marco Cantu's Blog. Only verifying the file dates has to be so ne manual, which is a little unprofessional .
  6. Achim Kalwa

    Delphi 10.4 PATCH 2 experiences

    Hello Peter, yes, the downloaded update/patch needs to be installed manually. Close the IDE and doubleclick "patch2.bat". This will trigger the User Account Control (UAC) to give the patch app admin credentials. It will open a black console window, with quickly scrolling messages from the patch progress. I've installed that patch a few days ago; and I can confirm that - no information about the patch is in the About dialog. - the Access Violation in the LicenseManager.exe is fixed. You can verify if the patch was installed successfully by checking the timestamp of some files in the "C:\Program Files (x86)\Embarcadero\Studio\21.0\bin" folder; it should be 2020-07-15 (using ISO date format): - LicenseManager.exe: - dcc32.exe - getit270.bpl If the files are still older (e.g. 2020-05-16), the patch has NOT been installed. Just try again 🙂
  7. Uwe Raabe

    Book: Delphi Quick Syntax Reference

    How would this affect older Delphi versions, which are the relevant targets according to "(intended for library devs that have to support many compiler versions)"? The problem is, that you need to use always the latest version of this file as part of your library, so it is capable to handle all Delphi versions. Even if starting with 10.5 Delphi would provide such a file itself, it will be outdated as soon as 10.6 arrives. So you have to use the newer file even for older Delphi versions, which somehow rules out such a file coming with Delphi itself.
  8. Stefan Glienke

    Anybody up for an ethics question?

    @Rollo62 Reminds me of Zen of Python
  9. Cristian Peța

    TIDHTTP -v- THTTPCLient

    THTTPClient doesn't work on Windows 7 and XP with SSL. On XP the message is "Server Certificate Invalid or not present" I don't find the message from Windows 7 but here is something about: https://stackoverflow.com/questions/50765476/delphi-tnethttprequest-tnethttpclient-works-on-win-10-but-not-win-7
  10. Remy Lebeau

    Assign a pointer to a dynamic array

    I would use PWord: function SomeFunction(segment_ptr: Pointer; segment_count: Integer ): TSmallintArray; var i: Integer; p : PWord {absolute segment_ptr}; begin SetLength(Result, segment_count); p := PWord(segment_ptr); for i := 0 to segment_count-1 do begin Result[i] := SwapInt16(p[i]); // or, if POINTER_MATH is not available on PWord: // Result[i] := SwapInt16(p^); Inc(p); end; end;
  11. Remy Lebeau

    How to detect the active app

    GetTopWindow() returns the CHILD window that is at the top of the z-order of a specified PARENT window. GetActiveWindow() returns the currently active window belonging to the CALLING THREAD (or another thread that is assigned to the message queue of the calling thread). Neither of those are well-suited for finding the active window of ANOTHER app. Have a look at GetForegroundWindow() instead.
  12. Slightly OT: Use whatever you want for private projects or within a company but please - whenever someone does open source don't turn off possible contributors by having to install yet another VCS. Git has won, deal with it!
  13. MarkShark

    Buggy Optimizer in Delphi 10.4

    Although I avoid using Goto (and usually With as well) in my own code. I appreciate the library writers who do whatever they can for performance or usability! I think I still use the "super pos" function that was written for the old fastcode challege which has a bunch of gotos and is amazingly fast.
  14. https://github.com/Kryuski/AnsiToUtf8
  15. Fr0sT.Brutal

    Book: Delphi Quick Syntax Reference

    I gathered most valuable ones of them in https://github.com/Fr0sT-Brutal/Delphi_Compilers (intended for library devs that have to support many compiler versions)
  16. Geoffrey Smith

    Sending Email via GMail Using OAuth 2.0 via Indy

    I've updated my project so it now not only sends messages via gmail... but it can send hotmail.com/live.com/outlook.com emails. GmailAuthSMTP supports the XOAUTH2 and OAUTHBEARER authentication types and so could probably support other mail providers if they use those standards as well. https://github.com/geoffsmith82/GmailAuthSMTP/
×