Jump to content

Kryvich

Members
  • Content Count

    402
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by Kryvich


  1. @Mike Torrettinni What version of Delphi are you using and what compiler directives are set? I ran your test in Delphi 10.3 CE and I got the same assembler code for both cases.

     

    TestStringHelper.dpr.23: if (vSearchValue = '') and (vItemValue <> '') or (vItemValue = vSearchValue )
    004E9AA1 837DFC00         cmp dword ptr [ebp-$04],$00
    004E9AA5 7506             jnz $004e9aad
    004E9AA7 837DF800         cmp dword ptr [ebp-$08],$00
    004E9AAB 750B             jnz $004e9ab8
    004E9AAD 8B45F8           mov eax,[ebp-$08]
    004E9AB0 8B55FC           mov edx,[ebp-$04]
    004E9AB3 E8301CF2FF       call @UStrEqual
    ...
    TestStringHelper.dpr.29: if IsSearchByValueFound_Inlined(vSearchValue, vItemValue)
    004E9B49 837DFC00         cmp dword ptr [ebp-$04],$00
    004E9B4D 7506             jnz $004e9b55
    004E9B4F 837DF800         cmp dword ptr [ebp-$08],$00
    004E9B53 750B             jnz $004e9b60
    004E9B55 8B45F8           mov eax,[ebp-$08]
    004E9B58 8B55FC           mov edx,[ebp-$04]
    004E9B5B E8881BF2FF       call @UStrEqual

     

    • Thanks 1

  2. Very interesting library! I am used to use SimpleXML, but if your library is really that fast, I will definitely switch to it. SimpleXML supports ANSI encoding to reduce memory usage, but I think it will not be too difficult to add ANSI to Neslib.Xml.

     

    Converting one of my program from SimpleXML to Neslib.Xml was not difficult, but I ran into an exception EIntOverflow in the procedure TXmlPointerMap.Map. Call stack is:

    Quote

    Neslib.Xml.Types.TXmlPointerMap.Map($406FDB,4765096,$19FDF8)
    Neslib.Xml.Types.TXmlPointerMap.Map($B50FF0,0,$B51008)
    Neslib.Xml.TXmlAttribute.SetNext(($B51008))
    Neslib.Xml.TXmlNode.InternalAddAttribute(5,'4')
    Neslib.Xml.TXmlNode.AddAttribute('check2','4')
    ExportToXml.DoExportToXml($27E1AF0,TXmlDocument($27D3604) as IXmlDocument)
    ExportToXml.ExportToXml

    I was able to make a truncated test project to demonstrate the exception, please look at the attachment.

     

    P.S. And thank you for the insightful article. I like this type of optimizations!

     

    Test Export To XML.zip


  3. @A.M. Hoornweg It depends on Windows ANSI codepage. I have CP-1251.

    Quote

    It appears that the Widechar ordinal values are THE SAME as the Ansichar values
    It appears that converting back to binarystring is SAFE
    It appears that converting back to ANSIstring is UNSAFE
    It appears that converting back to RAWBYTEstring is UNSAFE

    The compiler also issues a lot of warnings:

    Quote

    [dcc32 Warning] Ansistring28591.dpr(23): W1057 Implicit string cast from 'Binarystring' to 'string'
    [dcc32 Warning] Ansistring28591.dpr(33): W1058 Implicit string cast with potential data loss from 'string' to 'Binarystring'
    [dcc32 Warning] Ansistring28591.dpr(37): W1058 Implicit string cast with potential data loss from 'string' to 'AnsiString'
    [dcc32 Warning] Ansistring28591.dpr(38): W1057 Implicit string cast from 'Binarystring' to 'string'
    [dcc32 Warning] Ansistring28591.dpr(38): W1057 Implicit string cast from 'AnsiString' to 'string'
    [dcc32 Warning] Ansistring28591.dpr(41): W1058 Implicit string cast with potential data loss from 'string' to 'RawByteString'

     

    Ansistring28591.dpr


  4. @WillH Actually the project is maintained 17 years by these people

    Quote

    We have our Bold source in a private repository and can contribute anytime. It has been in production for 17 years now. We make continuous bugfixes and optimizations in the source. Sometimes also new features. Currently, we are using Delphi 10.3 Rio but will soon switch to 10.4 Sydney.

    Now they can legally open their changes to everyone.

    • Like 2

  5. So how you like a syntax Embarcadero finally choose for initialization / finalization of the custom managed records?

    type
      TMyRecord = record
        Value: Integer;
        class operator Initialize (out Dest: TMyRecord);
        class operator Finalize(var Dest: TMyRecord);
        class operator Assign (var Dest: TMyRecord; const [ref] Src: TMyRecord);
      end;

    Early in 2018 Marco showed a slightly different syntax.

    I personally would prefer something like

    type
      TMyRecord = record
        Value: Integer;
        operator Initialize;
        operator Finalize;
        operator Assign(const [ref] Src: TMyRecord);
      end;

    Then Dest would be replaced by Self.

×