News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Ring buffer vs HeapAlloc

Started by jj2007, February 25, 2022, 04:02:35 AM

Previous topic - Next topic

jj2007

Quote from: mikeburr on March 21, 2022, 09:50:07 PM
interesting .. sort of JJ .. but i presume youve hard coded the buffer into the data area ??

Yes.

include \masm32\MasmBasic\MasmBasic.inc
  Init
  Recall "\Masm32\include\Windows.inc", L$()
  Dim out$(eax)
  NanoTimer()
  For_ ecx=0 To L$(?)-1
        ; uses the ringbuffer 3x26906 = 80706 times:
        Let out$(ecx)=Str$("String #%i\t", ecx)+Left$(L$(ecx), 20)+" ... "+Right$(L$(ecx), 8)
  Next
  Inkey NanoTimer$(), Str$(" for creating %i strings", ecx)
  Store "outstrings.txt", out$()
  ShEx  "outstrings.txt"
EndOfCode


15 ms for creating 26902 strings

Show me how to do it faster with HeapAlloc.

hutch--

 :biggrin:

As the MAC user would say, mammory is mammory, wotz the big deal.

If you have a start address and know the length boundary of the memory, the MAC user with a slight spelling change is correct.

mikeburr

jj...... theres no way heap alloc is going to be as quick ...
regards mike b