Jump to content

RDP1974

Members
  • Content Count

    235
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by RDP1974

  1. anyway (IMHO) Delphi should have an updated default allocator, multithreading friendly (especially for web applications) kind regards
  2. "they use low-level OS calls like VirtualAlloc or mmap() to reserve big blocks of memory (a few MB), then split them and manage smaller blocks" I know this, but look there https://users.rust-lang.org/t/why-dont-windows-targets-use-malloc-instead-of-heapalloc/57936 I guess if we can use directly the os heap api as default memory manager btw. under Delphi for Linux webbroker as apache module, for example, has dozens of times the performances of windows (with default MM) (but there it's a license violation, windows server agreement denies to use/show performance benchmarks..) btw. only for talks, webbroker classes are excellent coded, they "pass" natively through "httpd extensions" as isapi or apache modules, but in native socket they use Indy, a one to one blocking thread architecture that doesn't performs well under windows (ancient bsd style architecture). For sure windows server has equiparable performances and scalability as linux using kernel servers (eg.winhttp) or iocompletionports with async overlapped io (very hard to code although) btw. tbb is well used in industry, of course ram use is high kind regards
  3. can I ask, "ninja" coders tell that's an error to encapsulate a memory manager over/inside the os heap manager C, C++, Rust are using heap calls directly under windows (heap api) and glib api malloc* under gnu those latest OS are driving and managing correctly fragmentation, etc. without the needings of a MM layer can I ask your opinion? thanks
  4. https://gist.github.com/danieleteti/1422ef290e20e9529106ae7c9aed0968?fbclid=IwAR1iokzrUKdV2hm-gp63ufE9g-DQFsrt3Qyvwaga8TzKafgigYSKJmjc344 from dmvc fb group from 353 to 4869 https://www.facebook.com/groups/delphimvcframework
  5. I have just asked the DMVC group if they can do a test over a real application kind regards
  6. hi, https://github.com/RDP1974/DelphiMSHeap please can somebody do a speed test for single thread application? I did a test, see attachment, and single thread performances are identical (and with multithreaded web app it's quicker than intel tbbmalloc) thank you btw. I did small changes as inline directive and zeromemory on sysalloc within the api call top = 32bit down = 64bit sx = default MM delphi dx = MSHeap delphi (delphi 11.2 i9 cpu windows 10) pokerBench.rar webbroker test (see first post at begin) Concurrency Level: 100 Time taken for tests: 0.269 seconds Complete requests: 1000 Failed requests: 0 Keep-Alive requests: 0 Total transferred: 250000 bytes HTML transferred: 114000 bytes Requests per second: 3716.52 [#/sec] (mean) Time per request: 26.907 [ms] (mean) Time per request: 0.269 [ms] (mean, across all concurrent requests) Transfer rate: 907.35 [Kbytes/sec] received
  7. look here https://users.rust-lang.org/t/why-dont-windows-targets-use-malloc-instead-of-heapalloc/57936 Rust calls directly Winapi for the heap, also there tells that using an allocator over the Windows allocator it is not a correct way so it is ok to use directly the Winapi allocator as before explained. I will use it for next projects seeing the behavior (but if the Rust language uses it directly seems a better way and to get rid of the default mm) kind regards
  8. https://docs.microsoft.com/it-it/windows/win32/memory/heap-functions https://docs.microsoft.com/it-it/windows/win32/memory/low-fragmentation-heap interesting feature https://docs.microsoft.com/it-IT/windows/win32/api/heapapi/nf-heapapi-heapsetinformation //we can try to use flag 3 optimize to shrink the cache Enable the low-fragmentation heap (LFH). Starting with Windows Vista the LFH is enabled by default but this call does not cause an error. // HeapInformation = HEAP_LFH; bResult = HeapSetInformation(hHeap, HeapCompatibilityInformation, &HeapInformation, sizeof(HeapInformation)); HeapOptimizeResources 3 If HeapSetInformation is called with HeapHandle set to NULL, then all heaps in the process with a low-fragmentation heap (LFH) will have their caches optimized, and the memory will be decommitted if possible. If a heap pointer is supplied in HeapHandle, then only that heap will be optimized. Note that the HEAP_OPTIMIZE_RESOURCES_INFORMATION structure passed in HeapInformation must be properly initialized. well, if it is reliable, can be a good solution for delphi next update maybe? look actually also 11.5 performs poorly in multithread scenario
  9. for curiosity I have done a test of this basic allocator over the heap functions of windows (without visual c runtime) and performances are equiparable to fmm5 and tbbmalloc. However I don't know if windows under the hood manages correctly fragmentation, paging? unit MSHeap; {$O+} interface uses Windows; implementation var ProcessHeap: THandle; function SysGetMem(Size: NativeInt): Pointer; begin Result := HeapAlloc(ProcessHeap, 0, Size); end; function SysFreeMem(P: Pointer): Integer; begin HeapFree(ProcessHeap, 0, P); Result := 0; end; function SysReallocMem(P: Pointer; Size: NativeInt): Pointer; begin Result := HeapReAlloc(ProcessHeap, 0, P, Size); end; function SysAllocMem(Size: NativeInt): Pointer; begin Result := HeapAlloc(ProcessHeap, 0, Size); if (Result <> nil) then FillChar(Result^, Size, #0); end; function SysRegisterExpectedMemoryLeak(P: Pointer): Boolean; begin Result := False; end; function SysUnregisterExpectedMemoryLeak(P: Pointer): Boolean; begin Result := False; end; const MemoryManager: TMemoryManagerEx = ( GetMem: SysGetmem; FreeMem: SysFreeMem; ReallocMem: SysReAllocMem; AllocMem: SysAllocMem; RegisterExpectedMemoryLeak: SysRegisterExpectedMemoryLeak; UnregisterExpectedMemoryLeak: SysUnregisterExpectedMemoryLeak ); initialization ProcessHeap := GetProcessHeap; SetMemoryManager(MemoryManager); end.
  10. I did a test with FMM5 and the performances with apachebench and webbroker are similar to the Intel allocator. But I don't know the reliability and fragmentation during the time. Old projects in pascal code as NexusMM or scalemm2 I have not benchmarked them, those projects seems abandoned. About C allocators world I have done a try with the most used: hoard, jemalloc, tcmalloc, mimalloc, rpmalloc, umm_malloc, tbbmalloc: none of these can be linked statically $L inside Delphi (without DLL dependancy) neither using visual c wrappers (the main problem is the $TLS linker error)
  11. https://github.com/YWtheGod/LIBC this is an interesting project, but C sources of the objects are not provided, so I will not try to use it there is System.Win.Crtl, but still needs visual c runtime redistribution in the os
  12. many people asked me about an allocator compiled statically as object, with LLVM clang for example I have seen many builds from many authors, but as far I have tested them, cannot be possible to produce static objects compatible, many of them are producing C++ libs, some other are using C runtime functions not available under delphi, or using special $tls api not implemented in the linker, or calling visual c runtime (in windows port).
  13. hi, the lib will automatically adapts functions upon the instruction set of the cpu. From sse2 to avx512. Personally I use it on servers and also, for example in desktop apps with devexpress vcl grids, firedac, etc. Runs on production over i3, i5, i7, i9 without glitches and absolutely reliable. I had thousands of downloads without problems reported, but thanks. look, obviously runs in 64bit only. Consider with some libraries the mmalloc can produce exceptions, you should see the source and correct, anyway rarely happens on bad code on debug mode. btw. I’m non endorsed with Intel, simply these libs are very excellent and well used in industry. Kind regards. Btw. for sources simply install from the links the products, there is a cmake for mmalloc and a python script for the rtl. Btw. of course I prefer native pascal roots, waiting the enhancements on next Delphi updates.
  14. Hi, about allocator, it's well used in industry as for videogames, server apps, the large initial footprint is due to a caching tls thread pool, and it is negligible imho but there is not only the mm, the patch replaces fundamental RTL: function SeaZero(Pdst: PByte; Len: NativeUint): Integer; cdecl; // fillchar 0 (zeromem) function SeaCopy(const Psrc: PByte; Pdst: PByte; Len: NativeUint): Integer; // copymem function SeaMove(const Psrc: PByte; Pdst: PByte; Len: NativeUint): Integer; //movemem function SeaSet(Val: Byte; Pdst: PByte; Len: NativeUint): Integer; cdecl; // fillchar with #char function SeaFind(const Psrc: PByte; Len: NativeUint; const Pfind: PByte; Lenfind: NativeUint; Pindex: PNativeUint): Integer; cdecl; //very fast Pos() function SeaCompare(const Psrc1: PByte; const Psrc2: PByte; Len: NativeInt; Presult: PNativeInt): Integer; cdecl; // comparemem function SeaUpperCase(const PSrcDst: PByte; Len: NativeUint): Integer; cdecl; // uppercase Latin 8bit function SeaReplace(const Psrc: PByte; Pdst: PByte; Len: NativeUint; oldVal: Byte; ipp8u: Byte): Integer; cdecl; // char replace then zlib too it is patched to use simd instructions (5x faster than default gzip) the sources are from these tools https://www.intel.com/content/www/us/en/developer/tools/oneapi/ipp.html and https://www.intel.com/content/www/us/en/developer/tools/oneapi/onetbb.html I cannot post Intel sources of course I can tell that the DLLs are done perfectly with updated and clean visual studio 2022 toolchain, without touching the Intel sources, produced with zero warnings. Absolutely clean. kind regards R. btw. Delphi 12 with FMM5 and enhanced Move, FillChar and Pos will solve everything!
  15. RDP1974

    faster json library

    hi, I see many json libraries available, perhaps somebody knows which is the faster/reliable for a intensive server app? seems very good the https://github.com/grijjy/GrijjyFoundation Grijjy base json bson? any feedback?
  16. RDP1974

    TDICTIONARY

    hi, do you know if https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Generics.Collections.TDictionary.Remove remove method will dispose an inserted record automatically?
  17. RDP1974

    TDICTIONARY

    thanks for explain
  18. RDP1974

    TDICTIONARY

    I was wondering about use a record instead of a class or a object if add will call a mem place for the record of maybe if we should use New and Dispose on remove probably is better stay with a basic class creation and disposal the doc is unclear, if remove dispose the loaded struct or should be done manually
  19. RDP1974

    IPC named pipes

    do you know if it is possible to setup a IPC named pipe into one PC act as sender, and a named pipe into another PC act as receiver (within the same windows workgroup or ad subnet) if yes can you suggest components available? If I don't mind firewall permits this communication over the 445 tcp?
  20. RDP1974

    svg

    do you know a high quality SVG library for Delphi? commercial or free is ok thanks
  21. RDP1974

    rubicon 4

    hello, somebody is using rubicon 4 with firedac firebird? the most important question, it's reliable, it's scaling? it's better than firebird embedded sql full text search? thanks
  22. RDP1974

    rubicon 4

    it's reliable?
  23. RDP1974

    NT API components

    do you know commercial components with NT API capabilities? - list the groups and the users of active directory or smb - install remove agents centrally through server admin rights (installing silently software through the lan desktops, without user interaction) ...
  24. RDP1974

    NT API components

    perhaps do you remember the name of the suite? thanks
  25. RDP1974

    twebbrowser capabilities

    hello, I'm wondering if TWebbrowser under android and ios does support webrtc and websocket plz let me know thank you
×