Author Topic: Ring buffer vs HeapAlloc  (Read 1165 times)

jj2007

  • Member
  • *****
  • Posts: 12471
  • Assembler is fun ;-)
    • MasmBasic
Re: Ring buffer vs HeapAlloc
« Reply #15 on: March 21, 2022, 10:15:38 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


Code: [Select]
15 ms for creating 26902 strings
Show me how to do it faster with HeapAlloc.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 9353
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Ring buffer vs HeapAlloc
« Reply #16 on: March 21, 2022, 10:24:12 PM »
 :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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

mikeburr

  • Member
  • **
  • Posts: 176
Re: Ring buffer vs HeapAlloc
« Reply #17 on: March 23, 2022, 04:05:21 AM »
jj...... theres no way heap alloc is going to be as quick ...
regards mike b