Jump to content

Anders Melander

Members
  • Content Count

    2297
  • Joined

  • Last visited

  • Days Won

    119

Posts posted by Anders Melander


  1. 3 minutes ago, Attila Kovacs said:

    Thomas obviously needs

    IMO it's not that clear what he needs.

    dupError is set which means that duplicates should cause an exception, but the code explicitly produce duplicates - and prevents them from being added.

     

    Anyhow, I don't think I have anything to contribute on the topic that a quick google search couldn't have provided in the first place.


  2. 1 hour ago, dummzeuch said:

    Where am I sorting the string list?

    Here:

    17 hours ago, dummzeuch said:
    
    procedure Tf_HashedStringListTest.DoTiming(sl: TStringList);
    ...
    begin
      sl.Sorted := True;
    ...

     

     

    1 hour ago, dummzeuch said:

    It's set to be sorted in the beginning and not changed. Actually I didn't post the code for the string list at all, just for the hash and the dictionary.

    Okay, but setting Sorted=True and then adding to the list will keep the list sorted; It's using binary search to find the insertion point so it's not that bad, but it might be better to add unsorted and then sort at the end. It depends on the dataset.


  3. 10 hours ago, David Schwartz said:

    If you're working with 32-bit apps and they work perfectly, and you're not using any of the new stuff being added to the Delphi ecosystem at it's fringes, and upper management asks why you need to upgrade everything to work with the latest Delphi release, what do you tell them?

    Tell them you agree.

    If the applications are in maintenance mode then I don't see any reason to upgrade, potentially introducing new problems with no benefit to the company or its customers.

     

    Keeping Delphi, and 3rd party libraries, up to date is a costly investment and unless a product is being actively developed that investment might not yield a sensible return.

     

     

    9 hours ago, Uwe Raabe said:

    I personally have seen a couple of such endeavors going down the drain. They could as well have burned the money in the first place.

    Whenever someone mentions the idea of a completely rewriting something from scratch I simply respond "Like Netscape?"

     

    https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/

    Quote

    We’re programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We’re not excited by incremental renovation: tinkering, improving, planting flower beds.

     

    I've been through a couple of successful complete rewrites myself, but they were architectural rewrites that were done incrementally. We basically refactored everything one tiny thing at a time until we finally arrived at the destination, many years later. And we stayed with Delphi. An incremental rewrite isn't really possible when you're replacing the platform.

    • Like 4
    • Thanks 1

  4. 1 hour ago, dummzeuch said:

    Or I am overlooking something else entirely

    It's a bit hard to see what exactly it is you're benchmarking with that code.

     

    Your first loop is supposedly meant to measure Add performance, but it also contains a Lookup. And after the first iteration of the outer loop it just produces duplicates, but then skips all those duplicates.

    Also your test is too synthetic. Use realistic data instead. I'm guessing your actual data isn't all possible three character strings with perfect distribution...

    And is sorting the stringlist after each insert really a realistic scenario?

     

    If you're really that interested in the performance of your dictionary I suggest you profile with real data instead of this guesswork.


  5. 2 hours ago, Kas Ob. said:

    Andres, i respect every one, no matter how we think differently, i didn't attack single person, you went ahead and made personal attack, not cool man.

    There was nothing in what I wrote that was directed at you personally but if I have offended you I apologize for that.

     

    I really do understand your POW and I agree with most of the problems you and others have, repeatedly, pointed to. What I object against is the one sided, two dimensional, demonization of Embarcadero.

     

    I too have been down the road of a disgruntled customer. I experienced a great misalignment between the needs of me and my company as a customer and the direction Embarcadero took with Delphi. There was also the whole Resource Editor debacle, which I won't go into here. We knew from experience that complaining about things didn't make any difference, so we decided to vote with our money. After Delphi XE we cancelled all maintenance contracts and recommended to our clients that they do the same. Personally I stopped participating in the community and I no longer released any open source stuff. Basically I took my ball and went home. That was 10 years ago.

    Around the time Delphi 10.2 was released I had finally cooled down. I had also come to the realization that the primary reason why I became a disgruntled customer in the first place was that my expectations were wrong. I had once seen Borland as "my friend" and I hadn't adjusted to the new reality of Delphi struggling to survive and stay relevant. I expected them to behave in a certain way and when they didn't I was disappointed. I not taking all the blame for that because they certainly tried to make us believe in the dream. I'm taking the blame for believing it.

    • Like 1

  6. 11 minutes ago, Vandrovnik said:

    May be Embarcadero could explain how they decide what to do and what to postpone... and postpone...? Because when I compare Embarcadero with TMS or Fastreport (or you), it is often reaction several years vs. several days, which I really do not like.

    I don't like it either. Like everyone else I would love for every bug to be fixed yesterday, the compiler to produce better code, the VCL and RTL to support all the new shiny stuff and that my wife was 20 again. I'm assuming Embarcadero has the same wishes (Okay, maybe they don't care about my wife) but obviously their first priority is to make money. They're not in it for the Karma.

     

    I myself used to be very vocal in the field test newsgroups in my critique of the decisions made by the various owners of Delphi during the years, to the point that I was asked not to participate in the field tests. So it's not like I don't understand the frustration or the need to vent it. However I also know that I don't know all about why they make the decisions they do. If I were in their shoes I might make the exact same decisions.

     

    Of course they make mistakes. They make huge mistakes sometimes *cough* Delphi 8 *cough*. That is obvious to all. But it gets really tiresome to constantly read this whining about how bad Delphi is or how evil Embarcadero are. It's leading nowhere. Not a day goes by that I don't curse some part of Delphi to hell, but at the same time Delphi has payed for my house, my cars, my children's education and all my vacations.

     

    Anyway, this has nothing to do with hash tables. Sorry for hijacking the thread.

    • Like 4

  7. You might want to look at the Windows Event Tracing API. I haven't used it personally.

     

    What I have used is something like this:

    1. In your application the log entries are written to a thread safe, lock free, linked list (Windows SList).
    2. A separate thread reads from the SList and write entries to a circular buffer in a memory mapped file.
    3. A separate process reads entries from the circular buffer in the memory mapped file and write the entries to a disk files.
    • Like 1

  8. 24 minutes ago, Steve Maughan said:

    Do you know of any code snippets?

    It's left as an exercise for the student 🙂

    The only code I have is a 10 year old example I once made in the Graphics32 newsgroup to demonstrate why cleartype AA shouldn't be used with the technique I described.

    Code and executable attached. Note that the code probably requires a 10 year old version of Graphics32 to compile.

     

    Here's the screenshots that accompanied the example (Looks like Win XP :classic_wacko:😞

     

    Shows regular text output with no blending.
    ClearType artifacts are clearly visible because of scaling. This is expected.

    AA-opaque.thumb.png.78c2e50d61a34422f0122dd1af43c3c1.png

     

    Shows text output with alpha blending. Alpha is calculated from a single channel.
    Alpha blended Gray Scale AA is identical to opaque Gray Scale AA.
    Alpha blended ClearType AA shows asymmetry.

    AA-blend1channel.thumb.png.a0b0faf639527dabebb60c97030d90f3.png

     

    Shows text output with alpha blending. Alpha is calculated from all three channels.
    Alpha blended Gray Scale AA is identical to opaque Gray Scale AA.
    Alpha blended ClearType AA is symmetric, but lacks detail.

    AA-blend3channels.thumb.png.13c3952ffa5825fcfe4c1c0d043adf89.png

     

     

    amAAtest.zip

    AAtest.zip


  9. I would just use Graphics32 but you can do it with regular TBitmap's - it's just more work.

    What you do is draw white text onto a black bitmap. Make sure ClearType anti aliasing is disabled or you will get artifacts. Use regular greyscale anti aliasing instead.

    This bitmap can now be merged (RGB only, there's no alpha) directly onto the destination bitmap or it can be used as an alpha mask to draw in any color or pattern. To use it as an alpha mask you just transfer any of the R, G or B values (they're the same) to the A channel and then reset the RGB to whatever color you want.


  10. 7 minutes ago, Lars Fosdal said:

    I guess you could wrap it in another pair of begin/end - but that would look a bit strange, while the with signals clearly that these are local.

    You already have a begin...end pair:

    with whatever do
    begin
    end;

    So why not just move the inline inside the begin...end and get rid of the with:

    begin
      var thisorthat := whatever;
      ...
    end;

    I see no reason to change the language so we can keep using with. Just get rid of it and forget it ever existed.

    • Like 3
    • Thanks 1

  11. 3 minutes ago, Sherlock said:

    Well, not showing exceptions and eliminating exception handling altogether are two different pairs of shoes, are they not?

    Killing all exceptions with empty try...except and disabling range and overflow checking amounts to the same thing.

    Not showing exceptions is a different topic. I don't believe the users should see the raw exception messages if it can be avoided, but when something goes wrong, that the application cannot reliably recover from by itself, then they need to know there is a problem and what to do about it.

    • Like 2

  12. I'm currently working on a project where they (my client) have done everything they can to kill or hide exceptions. It's a nightmare. All I have to work on is vague reports from the users that "something" doesn't work, sometimes - and of course Range and Overflow Checks are disabled too, because they cause exceptions...

    I've tried removing all the empty try...except blocks but then the application can't even start because there are so many bugs in it. Luckily I only have 4 months left on that contract :classic_dry:

     

    The sad thing is that I've seen this thing so many times. Some idiot developer can't figure out how to fix a bug to they hide it with a try...except and then it becomes a habit.

    • Like 1
×