Jump to content

RDP1974

Members
  • Content Count

    247
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by RDP1974


  1. On 4/9/2025 at 11:14 AM, Stefan Glienke said:

    I don't step into that territory because you cannot simply make general-purpose collections thread-safe. It already starts with simple things like: how do you protect a list where one thread adds/removes items and another iterates over it?

    oneapi tbb concurrent hash map when call iterate() does a snapshot copy of the collection and publish it, meantime protecting keys with acc (similar to critical section)

    btw. concurrent_queue test with 10 threads is 3x quicker than TOmniQueue, and unfortunately TThreadedQueue goes in deadlock


  2. hi, I wish to not be offtopic, and to be useful

    anyway there https://github.com/RDP1974/Delphi64RTL I have added concurrent queue, thread safe, from OneApi v2022.1

    also a small test there (single thread, create and dispose string, 10M push + 10M pop within 1 sec)(I have not time to do multithread test now)

    kind regards

    btw. this repo is a base for a mine custom server reactor+proactor done in Delphi


  3. guess a pool with 100 tthreads, each with a queue fifo receiving messages, also each tthread send messages simultaneously to every all others: 
    then a tthreadqueue without global locking as CRT should be the faster solution?

     

    as far I have researched then the spring4d queue lock free seems the fastest solution (but I cannot find it in the source)

     

    finally -> OmniThreadLibrary -> TOmniBaseQueue -> Dynamically allocated, O(1) enqueue and dequeue, threadsafe, microlocking queue
    or TOmniMessageQueue (ring buffer)

    also I have found a ring buffer from https://blog.grijjy.com/2017/01/12/expand-your-collections-collection-part-2-a-generic-ring-buffer/

     

    please can you suggest me the best code, libraries to achieve consumer-producers between threads? thanks

     

    btw.if I have time will do a dll for tbb::concurrent_queue 


  4. hi,

    I have a windows service where I dispatch a custom thread pool, dynamic, using IoCompletionPort api,

    then I have a component where methods should be called within the servicethread,

    my question is, do you know if servicethread.queue it is reliable? is this the best method to post things to the main thread in a safer way without incur in race conditions as deadlock?

     

    example, this code is called within a thread:

        TServiceThread.Queue(Service.ServiceThread, procedure
        begin
          dothings     
        end);

     

    kind regards


  5. hi,

    I like to do remote debugging, 

    I have installed PAserver 23 (from Delphi 12.2 paserver folder) into remote vps,

    then I have copied the \bin\rmtdbg290.exe to the paserver remote folder updating it,

    have done the profile manager for windows and paserver is connecting ok

    firewall ports open both paserver and remote debugger

    I obtain this error from delphi ide:

    376947241_02BC77D9-A1DB-486F-8E3B-5C28A1CC9382.thumb.png.6ae1cc05edb464d42c3b9edb86e0ac5f.png

     

    can somebody help me how to obtain remote debugging of windows vcl?

    thank you


  6. question

    do you remember the good old https://fastcode.sourceforge.net/ ? (2007 project)

    I asked chatgpt to convert asm32 to asm64 delphi, look at this example:

     

    procedure MoveJOH_SSE2_10(const Source; var Dest; Count : Integer);
    asm
      cmp     ecx, TINYSIZE
      ja      @@Large {Count > TINYSIZE or Count < 0}
      cmp     eax, edx
      jbe     @@SmallCheck
      add     eax, ecx
      add     edx, ecx
      jmp     SmallForwardMove_10
    @@SmallCheck:
      jne     SmallBackwardMove_10
      ret {For Compatibility with Delphi's move for Source = Dest}
    @@Large:
      jng     @@Done {For Compatibility with Delphi's move for Count < 0}
      cmp     eax, edx
      ja      Forwards_SSE2_10
      je      @@Done {For Compatibility with Delphi's move for Source = Dest}
      sub     edx, ecx
      cmp     eax, edx
      lea     edx, [edx+ecx]
      jna     Forwards_SSE2_10
      jmp     Backwards_SSE2_10 {Source/Dest Overlap}
    @@Done:
    end; {MoveJOH_SSE2}

     

    chat gpt rewrite this in 64bit:

    procedure MoveJOH_SSE2_10(const Source; var Dest; Count: Integer);
    asm
      cmp     r8d, TINYSIZE        // Compare Count (R8D) with TINYSIZE
      ja      @@Large              // If Count > TINYSIZE or Count < 0, jump to @@Large
      cmp     rcx, rdx             // Compare Source (RCX) with Dest (RDX)
      jbe     @@SmallCheck
      add     rcx, r8              // Adjust Source address: Source + Count
      add     rdx, r8              // Adjust Dest address: Dest + Count
      jmp     SmallForwardMove_10  // Jump to small forward move
    @@SmallCheck:
      jne     SmallBackwardMove_10 // If Source ≠ Dest, use backward move
      ret                           // If Source = Dest, exit (compatible with Delphi’s Move)
    @@Large:
      jng     @@Done                // If Count < 0, exit (compatible with Delphi’s Move)
      cmp     rcx, rdx
      ja      Forwards_SSE2_10      // If Source > Dest, use forward move
      je      @@Done                // If Source = Dest, exit
      sub     rdx, r8               // Adjust Dest address: Dest - Count
      cmp     rcx, rdx
      lea     rdx, [rdx + r8]       // Restore original Dest address
      jna     Forwards_SSE2_10      // If no overlap, use forward move
      jmp     Backwards_SSE2_10     // If overlap, use backward move
    @@Done:
    end;
     

    opinions? does this make sense to you? can we take the winners of fastcode 32bit and convert them in 64bit so easily?
    chatgpt then owns the copyright?


  7. lowering the size of the output to 2.5kB (json blob) instead of 46kB, isapi has this throughput (cpu near old 9th 14nm i9900-kf)

     

    Concurrency Level:      100
    Time taken for tests:   0.398 seconds
    Complete requests:      10000
    Failed requests:        0
    Keep-Alive requests:    10000
    Total transferred:      27800000 bytes
    HTML transferred:       26100000 bytes
    Requests per second:    25106.45 [#/sec] (mean)
    Time per request:       3.983 [ms] (mean)
    Time per request:       0.040 [ms] (mean, across all concurrent requests)
    Transfer rate:          68160.09 [Kbytes/sec] received


  8. with keep-alive isapi app

     

    Concurrency Level:      100
    Time taken for tests:   4.763 seconds
    Complete requests:      10000
    Failed requests:        0
    Keep-Alive requests:    10000
    Total transferred:      431790000 bytes
    HTML transferred:       430080000 bytes
    Requests per second:    2099.45 [#/sec] (mean)
    Time per request:       47.631 [ms] (mean)
    Time per request:       0.476 [ms] (mean, across all concurrent requests)
    Transfer rate:          88527.55 [Kbytes/sec] received

     

    in project source:

      Application.MaxConnections:=1000;
      Application.CacheConnections:=True;


  9. single request

    latest oneapi v.2022

    (see first page)

     

    Concurrency Level:      1
    Time taken for tests:   0.004 seconds
    Complete requests:      1
    Failed requests:        0
    Keep-Alive requests:    0
    Total transferred:      43146 bytes
    HTML transferred:       43008 bytes
    Requests per second:    285.06 [#/sec] (mean)
    Time per request:       3.508 [ms] (mean)
    Time per request:       3.508 [ms] (mean, across all concurrent requests)
    Transfer rate:          12011.05 [Kbytes/sec] received


  10. latest oneapi v.2022

    intel tbbmalloc with zlib deflate ac:

    https://github.com/RDP1974/Delphi64RTL

     

    Server Software:        Microsoft-IIS/10.0
    Server Hostname:        192.168.1.110
    Server Port:            80

    Document Path:          /isapi/testisapi.dll
    Document Length:        8416 bytes

    Concurrency Level:      100
    Time taken for tests:   5.478 seconds
    Complete requests:      10000
    Failed requests:        0
    Total transferred:      86170000 bytes
    HTML transferred:       84160000 bytes
    Requests per second:    1825.64 [#/sec] (mean)
    Time per request:       54.775 [ms] (mean)
    Time per request:       0.548 [ms] (mean, across all concurrent requests)
    Transfer rate:          15362.84 [Kbytes/sec] received

     

    without zlib deflate

    Document Path:          /isapi/testisapi.dll
    Document Length:        43008 bytes

    Concurrency Level:      100
    Time taken for tests:   5.236 seconds
    Complete requests:      10000
    Failed requests:        0
    Total transferred:      431740000 bytes
    HTML transferred:       430080000 bytes
    Requests per second:    1909.82 [#/sec] (mean)
    Time per request:       52.361 [ms] (mean)
    Time per request:       0.524 [ms] (mean, across all concurrent requests)
    Transfer rate:          80522.17 [Kbytes/sec] received

×