Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 06/02/21 in Posts

  1. I've seen several queries about 64 bit equivalents for the fast string routines in Win32. And I needed them myself as well. I have published (assembly based) functions that mimic system.Pos and sysUtils.StringReplace for 32 & 64 bit compiling (both String and AnsiString). Extra feature: searching can be case sensitive or case insensitive. Timing for string search (1k substrings in 1M string, microsec, see documentation; NextStrPos is new): mode 32 bit 64 bit search System.pos NextStrPos System.pos NextStrPos String 550 500 730 400 ANSIstring 530 460 3.500 360 Timing for String replace (1k substrings in 1M string, microsec, see documentation; StrReplace is new): mode 32 bit 64 bit replace SysUtils. StringReplace StrReplace SysUtils. StringReplace StrReplace String 6.500 1.050 6.000 1.050 ANSIstring 7.400 900 7.000 850 Files and documentation on https://sourceforge.net/projects/delphi-fast-pos-stringreplace/
  2. 0x8000FFFF

    Delphi and Azure DevOps?

    Jolyon Smith published series of articles in his blog about integration with Azure DevOps. You'll find much useful information there.
  3. In fact it can be a serious bottleneck !!! 1 - A copy operation may happen even if the block wasn't resized (same size) ... weak-ref : procedure DynArraySetLength(var a: Pointer; typeInfo: Pointer; dimCnt: NativeInt; lengthVec: PNativeint); //.... if SysHasWeakRef(PTypeInfo(ElTypeInfo)) then begin if newLength < oldLength then minLength := newLength else minLength := oldLength; GetMem(pp, neededSize); FillChar((PByte(pp) + SizeOf(TDynArrayRec))^, minLength * elSize, 0); if p <> nil then begin // ---> here <--- MoveArray(PByte(pp) + SizeOf(TDynArrayRec), PByte(p) + SizeOf(TDynArrayRec), ElTypeInfo, minLength); if newLength < oldLength then FinalizeArray(PByte(p) + SizeOf(TDynArrayRec) + newLength*elSize, ElTypeInfo, oldLength - newLength); FreeMem(p); end; end 2 - The operation executes on O(n) when the array is multidimensional : // Take care of the inner dimensions, if any if dimCnt > 1 then begin Inc(lengthVec); Dec(dimCnt); i := 0; try while i < newLength do begin DynArraySetLength(PPointerArray(p)[i], ElTypeInfo, dimCnt, lengthVec); Inc(i); end; except // Free arrays on exception for j := 0 to i do _DynArrayClear(PPointerArray(p)[j], ElTypeInfo); _DynArrayClear(p, typeInfo); raise; end; end; //--------------------------------- var LArray: array of array of Integer; begin SetLength(LArray, 100,10); SetLength(LArray, 100,10); // DynArraySetLength x100 end; 3 - The function can ruin the cache ! because it dereferences some rtti data and it relies on MM to check for the block size. If the check was implemented inside the function than we won't dereference any unnecessary data. 4 - Adding a simple check to compare old vs new length will be much better and avoids all the issues above. I think that you should fire a case.
×