Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 01/05/24 in all areas

  1. David Heffernan

    Data structure for Integer ranges

    Surely this could be done using regular expressions
  2. salvadordf

    WebUI4Delphi available at GitHub

    I just made public the WebUI4Delphi open source project at GitHub. WebUI4Delphi is a WebUI wrapper, which allows you to use any web browser as a GUI, with Delphi in the backend and HTML5 in the frontend. WebUI doesn't embed a web browser. It just connects your Delphi application with the installed web browser using a fast protocol so you can use HTML5 as part of the GUI. WebUI4Delphi can be used in 64 bit Delphi applications for Windows. Linux and MacOS support needs testing. There are several VCL, FireMonkey and console demos. https://github.com/salvadordf/WebUI4Delphi
  3. I cannot speak for Tommi, but I had a need for such a data structure where ranges of numbers were given in string format like "2,3,5,7-11,15-31" and the numbers going up to 6 digits. The actual testing for a given number being part of that was implemented by parsing the string each time, which turned out to be a bit time consuming. So we refactored it using a data structure similar to that shown above.
  4. Why would you stream the pointers? They only have any meaning inside each application as a reference to a memory position.
  5. dummzeuch

    Duration as string ?

    SecondsToHumanReadableString in my dzlib. There are probably others which I am not aware of. I just noticed that you wanted milliseconds support. My function does not support these.
  6. As long as we are talking about personal opinions, mine is just not moved much by this reasoning. Record pointers are nothing exotic or anachronistic in Delphi. That is a lot more common than having classes with no methods, imo. Also, there is nothing superior about a free call on a class compared to calling dispose on a record pointer. The Delphi language absolutely requires learning memory management. The removal of the misguided ARC baggage from the language shows that will not be changing. No reason to try to find ways to dumb it down.
  7. I don't know what to think after reading that article. Here are my comments on it: - the classic way of truncating the last 2 digits with div and mod 10 (or 100) does not involve a costly div or mod instruction on modern compilers (*cough* even Delphi 12 now does it - apart from the bugs that came with it) - I think C++ compilers would detect doing a div and a mod instruction and the code they emit would be further optimized so it does not require the "workaround" that the Delphi RTL uses by calculating the modulo by subtracting the div result times 100 from the original value. - the pseudo-code he shows for detecting the number of digits is correct but this is never what gets executed - and you either rewrite this into a few branches (as you can see in the RTL), a C++ compiler might unroll the loop or some other trickery is applied The DivBy100 function was introduced by me in RSP-36119 and I already notified them that DivBy100 can be removed in 12 because now it properly optimizes a div by 100 - however, that affects performance only by like 0.5% or so. As David correctly pointed out the real bottleneck is the heap allocation - and not only a single one when you just turn an integer into a string and display that one but when you concat strings and numbers the "classic" way because then it produces a ton of small temporary strings. That issue even exists when using TStringBuilder where one might think that this was built for optimization. If you look into some overloads of Append you will see that it naively calls into IntToStr and passes that down to the overload that takes string. This is completely insane as the conversion should be done directly in place into the internal buffer that TStringBuilder already uses instead of creating a temporary string, convert the integer into that one, pass that to Append to copy its content into the buffer. This will likely be my next contribution as part of my "Better RTL" series of JIRA entries.
  8. Lajos Juhász

    Email from Delphi using Thunderbird

    If you really have to you can use SMAPI. You can find a code from @Attila Kovacs here:
  9. Rick_Delphi

    Project in Seismic Field

    lol How many beers did you have for breakfast?
×