-
Content Count
197 -
Joined
-
Last visited
-
Days Won
1
Everything posted by RDP1974
-
hi, I have built the libraries with the latest sources of 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 had zero warnings or problems on compile. Here the files https://github.com/RDP1974/Delphi64RTL Look the TBB allocator is very prone to detect memory errors as double free or overruns. In multithreaded apps as web applications you will get a large performance improvement. Btw. Intel license is totally permissive free to distribute and deploy everywhere please let me know if you discover errors Quick test with WebBroker Indy app producing a plain: program Project1; uses RDPMM64, Vcl.Forms, Web.WebReq, ... procedure TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean); begin Response.Content := '<html>' + '<head><title>Web Server Application</title></head>' + '<body>Web Server Application '+FormatDateTime('yyyymmdd.hhnnss',Now)+'</body>' + '</html> end; Hyper-V i9 cpu windows 2022 server, 16 cores Host i9 cpu windows 10 pro Apache bench ab -n 1000 -c 100 -k -r http://localhost:8080/ Delphi 11 default Concurrency Level: 100 Time taken for tests: 1.845 seconds Complete requests: 1000 Failed requests: 0 Keep-Alive requests: 0 Total transferred: 250000 bytes HTML transferred: 114000 bytes Requests per second: 542.04 [#/sec] (mean) Time per request: 184.488 [ms] (mean) Time per request: 1.845 [ms] (mean, across all concurrent requests) Transfer rate: 132.33 [Kbytes/sec] received Delphi 11 (with Intel libs): Concurrency Level: 100 Time taken for tests: 0.297 seconds Complete requests: 1000 Failed requests: 0 Keep-Alive requests: 0 Total transferred: 250000 bytes HTML transferred: 114000 bytes Requests per second: 3364.56 [#/sec] (mean) Time per request: 29.722 [ms] (mean) Time per request: 0.297 [ms] (mean, across all concurrent requests) Transfer rate: 821.42 [Kbytes/sec] received
-
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
it's odd to me also that msheap and default mm are producing identical score, thus you can see the numbers inside are different. Really I didn't touch the images, only print-screen. Probably the source is using GetTickCount that's not so accurate, producing identical result. For sure using a highres api as QueryPerformance* the results should be more accurate. Anyway this is not a good tool for memory stress test. -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
where to find a general purpose "benchmark" or stress test? -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
Hi Eivind, I post here the results of my test (Delphi 11.2.1, I9 win11 2h22 host, win 2022 server hyper-v) In single thread we obtain similar performances among default mm, msheap and nexus in attached image: MSHEAP, NEXUS, DEFAULT MM in webserver multithreading it's excellent: MSHEAP Total transferred: 250000 bytes HTML transferred: 114000 bytes Requests per second: 2933.46 [#/sec] (mean) Transfer rate: 716.18 [Kbytes/sec] received NEXUS Total transferred: 250000 bytes HTML transferred: 114000 bytes Requests per second: 2943.01 [#/sec] (mean) Transfer rate: 718.51 [Kbytes/sec] received DEFAULT Total transferred: 250000 bytes HTML transferred: 114000 bytes Requests per second: 291.80 [#/sec] (mean) Transfer rate: 71.24 [Kbytes/sec] received -
hi, do you know a good source of algotithms for location based purposes? example calc the distance between two coordinates, etc. thank you
-
well, calculate the distance between two points is needed
-
thank you if I have time will try to implement a general purpose KNN R-Tree algorithm in pascal
-
can you suggest me a good tutorial about Delphi generics? especially, when and where they are useful? in which purposes? performance wyse are they trustable?
-
Delphi language is evolved a lot in the last years should be very useful a blog where to show the new language capabilities btw. example public type TWriteItem<T> = reference to procedure(const TaggedFile: ITaggedFile; const Item: T); a type inside a class? what is a reference to procedure? great, under the hood the enumeration how it is engineered? hash table? binary-search-tree? so the compiler will produce "bloat" code for every generic class if I see, else how to solve the fact that the type it is not defined before???
-
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
if you wish, provide me a copy of this MM, I will benchmark it, agree? -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
-
hi, I does exists a easy way to use a firedac custom monitor link inside a isapi webbroker?
-
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
please sorry I'm a old customer of Nexus and let me tell you that your code is a masterpiece! kind regards -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
anyway (IMHO) Delphi should have an updated default allocator, multithreading friendly (especially for web applications) kind regards -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
"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 -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
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 -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
https://gist.github.com/danieleteti/1422ef290e20e9529106ae7c9aed0968?fbclid=IwAR1iokzrUKdV2hm-gp63ufE9g-DQFsrt3Qyvwaga8TzKafgigYSKJmjc344 from dmvc fb group from 353 to 4869 https://www.facebook.com/groups/delphimvcframework -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
I have just asked the DMVC group if they can do a test over a real application kind regards -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
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 -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
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 -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
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 -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
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. -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
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) -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
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 -
64bit RTL patches with Intel OneApi and TBB
RDP1974 replied to RDP1974's topic in RTL and Delphi Object Pascal
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).