Jump to content

David Heffernan

  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by David Heffernan

  1. Open array of record, using a function or record constructor to populate new instances of that record. Syntax support for initialization is a bit crappy in Delphi sadly.
  2. David Heffernan

    TTimer equivalent with smaller interval

    The question literally asks about intervals less than that which you obtakn with a timer. You'll find that Sleep has the same performance as a timer.
  3. Strange way round. Wouldn't it be normal for you to prove your prime claim?
  4. David Heffernan

    TTimer equivalent with smaller interval

    Try timing Sleep(1) with TStopwatch.
  5. I'm not suggesting that you don't preallocate with a sensible capacity if you know it. I would always do that. In multithreaded code especially, minimising heap allocation is always advisable.
  6. Ofc, you don't have to use the RTL dictionary. The spring4d dictionary has a number of powerful features. I don't think the growth is such an issue. Collisions can be, and better hash and proving would help. The issue for small collections is simply the constant of proportionality. O(1) can be slower than O(log n) for small enough n.
  7. Not so simple. For small collections the dictionary can be slower.
  8. David Heffernan

    Combining bitmaps and preserving antialiased text quality...

    There is transparency at the pixel level. PNGs have an alpha channel for that.
  9. David Heffernan

    Combining bitmaps and preserving antialiased text quality...

    In general you can't do this. Anti-aliasing requires knowledge of the background at the point where the text is rendered. If the original background is a single colour then it may be possible, but will require clever processing. What you ought to do is simply render the text again on the new background.
  10. PPL is a library too. It's also quite big. Why does it matter how big a library is? It would seem odd to me that there would be no problem using a library known to have many defects still, over a high quality library. Who in their right mind would choose the lower quality library facing this choice?
  11. I find this to be a very apt principle.
  12. Much of the development I do is refactoring. Not for its own sake, but to enable a new development. Typically this means refactoring existing code, relying heavily on the testing of that code, so that the new development can be added easily. Often the bulk of the time is spent refactoring and then the new development is trivial. In other words, even when code is well factored, it often needs to be refactored. Also, its not at all the case that replacing standalone functions with classes always makes your code better. Don't be afraid to have standalone functions if that is the right design.
  13. David Heffernan

    TTimer equivalent with smaller interval

    Timers are event driven. You are suggesting polling. That's no good.
  14. Why is OTL overkill, and PPL is not?
  15. David Heffernan

    Spell Checker implementation?

  16. Imagine how fast it would be if you wrote code that didn't stress the heap allocator. That's the real route to performance. Real world benchmarks are the only ones that matter.
  17. David Heffernan

    class designation question

    They all do different things. Rather than have us explain this, did you read the documentation? I don't think that item 3 is very widely used. However meta classes, item 2, is widely used. Classic example is the streaming framework. It is used when you need to instantiate a class whose identity is only known at runtime. When streaming properties the framework reads the class name, looks it up using RTTI and then uses meta classes to instantiate the instance if that dynamically determined type. Always seen with virtual constructors.
  18. Threadvar is implemented on top of TLS on Windows. How is lock free going to handle deallocations made from a different thread from that which allocated the memory? But hey, if you want to write this code, go for it.
  19. David Heffernan

    Messages for exceptions only for main thread?

    All UI happens from the UI thread. So if you want an exception from another thread to result in UI, you need to marshal it into the main thread. Having madExcept in your process is great. But there are a class of exceptions that you don't want to trouble the user with a bug report. I call these expected exceptions. You need to decide on a policy for those exceptions.
  20. David Heffernan

    Error when installing JCL from GetIt

    GetIt, I just don't get it. Surely you are better off pulling from the repo?
  21. David Heffernan

    What are your compiler settings for debug builds?

    This is one of the reasons why the cool cats don't use RTL collections
  22. David Heffernan

    How to make app with tabbed set of VNC windows

    Cross process window parenting relationships never end well. Don't try this. https://devblogs.microsoft.com/oldnewthing/20130412-00/?p=4683
  23. David Heffernan

    How to make app with tabbed set of VNC windows

    Cross process UI is fraught with complications. I wouldn't dream of trying to parent a window from one process into another process.
  24. David Heffernan

    What are your compiler settings for debug builds?

    People for sure would rather have an error message than incorrect results. You are just kidding yourself if you say otherwise. It's simple human denial. Suppressing errors will result in a program with more defects. We all know this to be true. And yet people still choose the path with more defects. What happens when you access an array out of bounds with range checking disabled? Perhaps the memory is valid and so the program continues running. But now it's behaviour is unpredictable. Often you will corrupt memory which leads to obscure errors later that you can't tie back to the original defect. Or quite often it's a straight AV which is hardly preferable to a range check error, since it isn't reproducible.