Jump to content

Anders Melander

Members
  • Content Count

    2561
  • Joined

  • Last visited

  • Days Won

    133

Everything posted by Anders Melander

  1. Anders Melander

    Delphi Compilers - # lines of code

    Why? One is a compiler. The other is not(-ish).
  2. Anders Melander

    SudokuHelper - Example for uncoupled design via interfaces

    Yes it does seem to come from that SO thread. The problem as I see it is that it mixes a lock free solution, that's meant to operate on pointers, with reference counted interfaces. Also I don't like the practice of creating an object and then freeing it if it's not needed anyway, but that's besides the point.
  3. Anders Melander

    SudokuHelper - Example for uncoupled design via interfaces

    Doesn't look thread safe to me. I haven't looked at the code apart from the snippet you posted, but as far as I can see there's a race condition.
  4. Anders Melander

    SynEdit bracket highlight

    Yes. I'm not using that project at the moment so I haven't kept it up to date.
  5. Anders Melander

    Skia versus VCL for plotting points

    No doubt but not by that much. I would guess it would be about 25% faster than TBitmap.ScanLine. I.e. around 45 mS on my system. My point was more that it's not really fair to benchmark anything against TCanvas.Pixels since it's known to be dead slow. It's more of a convenience feature. Without having profiled the code I think the TBitmap.ScanLine implementation mostly suffers from the overhead of the call to GdiFlush inside TBitmap.GetScanLine. Since the original implementation writes the bitmap in X-Y order I duplicated that in order to be fair but this also means that the TBitmap.ScanLine implementation performs Width*Height calls to GetScanLine and thus GdiFlush. I circumvented this by caching the scanline row pointers in an array (without this it would have been slower than using TCanvas.Pixels). The X-Y order also means that each pixel write trashes the CPU cache - It should be significant faster in Y-X order.
  6. Anders Melander

    SynEdit bracket highlight

    The version I use works. I don't have time to check the difference in how we do it but you can see for yourself if you want to: https://bitbucket.org/anders_melander/dwscriptstudio/src/15b205a8a7b4d461b786452aa4e0ee548779fe92/Source/amScriptDebuggerMain.pas#lines-1184
  7. Anders Melander

    inherited dynamic message handlers

    I would guess that the override is based on the message number but it should be easy to determine; Just try it.
  8. Anders Melander

    brc32.exe no longer available in D11?

    The omission of brc32.exe is probably an installer bug Use brcc32.exe instead or better yet, use the MS resource compiler rc.exe
  9. Anders Melander

    Skia versus VCL for plotting points

    I just did: TCanvas.Pixels: 320 mS skia4delphi: 130 mS TBitmap.Scanline: 60 mS
  10. Here's a C implementation: https://github.com/yparitcher/libzmanim The code looks well written.
  11. You could roll your own: https://en.wikibooks.org/wiki/Computer_Programming/Hebrew_calendar Here's some code but I have no idea about what language that is: http://www.chelm.org/jewish/calendar/algorithms.html
  12. Anders Melander

    Adding an icon for an ActiveX control

    https://docs.microsoft.com/en-us/windows/win32/com/activex-controls-registry-information You can add the 16x15 bitmap to your Delphi project using Project > Resources and Images. Searching the Delphi source for "ToolboxBitmap32" I can see that TActiveXControlFactory has a ToolboxBitmapID property which you can use to specify the resource ID of the bitmap. The value of this property is written to the registry when the ActiveX control is registered. A .dcr file usually just contains the Delphi design time glyph of a component - I.e. the glyph you see on the component palette in Delphi. It has nothing to do with ActiveX controls.
  13. https://en.wikipedia.org/wiki/Law_of_triviality
  14. Exactly. It's pretty pointless to suggest different ways of doing conversion if the conversion will be done with TryStrToFloat, StrToFloat or the like. And it's even more pointless when this is in all likelihood premature optimization.
  15. The only built-in way to determine if a string can be converted by TryStrToFloat is to use TryStrToFloat. You could reverse engineer TryStrToFloat to make a version that only parsed the string and didn't actually do the conversion but my guess is that the majority of time used by TryStrToFloat is used by the parser, not by the conversion. But if you are reading from a text file then it's likely that the I/O will be your real bottleneck and as David hints at, you should profile first and optimize next.
  16. It depends on what you mean by "can be converted to number". If your definition is that TryStrToFloat returns True, then the answer is no. If you're willing to give up some of the features of TryStrToFloat then the answer is yes, but you are going to have to implement it yourself - in assembler. But why do you need it to be faster? Is it a bottleneck for you?
  17. Anders Melander

    rabbitmq-delphi release

    https://www.rabbitmq.com/protocols.html#amqp-10
  18. Anders Melander

    rabbitmq-delphi release

    Are you asking if RabbitMQ supports AMQP 1.0?
  19. Anders Melander

    document projects

    You don't need to add your own sub-fora. Just post in the main Delphi Third-Party.
  20. Anders Melander

    document projects

  21. Anders Melander

    document projects

    This belongs in Delphi Third Party.
  22. Anders Melander

    Herb Sutter on C++20

    Well, it's not that I don't envy the versatility of C++ but I really don't enjoy trying to maintain (or even just read) code that fully uses that versatility.
  23. Anders Melander

    Herb Sutter on C++20

    One hour into the video I wanted to shoot myself in the head - But then I remembered that I no longer program in C++ 🙂 Apart from that; Good stuff. When I heard Bjarne at the end I thought: He sounds tired of C++. Maybe he should try Delphi 🙂
  24. Anders Melander

    Is Graphics32 ready for Delphi 11 yet?

    That request is almost older than Delphi itself. I get that they're not interested in making it easier to use old versions of the product, but I don't get that they aren't interested in making the lives of 3rd party developers easier (in this regard at least).
  25. Anders Melander

    Looking for Spreadsheet component

    I haven't used the Develop Express spreadsheet (except that it seems that all their other controls now has dependencies on it 😞) but I would think it'd be trivial to maintain a dictionary on the side that links objects to cells...? type TCellReference = record Row: integer; Column: integer; end; TCellStuff = TObjectDictionary<TCellReference, TObject>; Also, if the spreadsheet architecture is anything like their other controls, then you should be able to customize what class is used to represent cells.
×