Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about _MEM blocks and arrays
#18
(06-08-2025, 04:48 PM)DSMan195276 Wrote:
(06-04-2025, 07:31 PM)madscijr Wrote: My question is, can't we update the compiler to be a little smarter, and generate code that uses these direct memory manipulation tricks, for commands like array(index)?

If you need to move large parts of an array though then `_Mem` is faster, `_MemCopy` uses faster techniques than just doing a loop. In theory the compiler could do optimizations like that, but determining whether a loop in the code can be replaced is complicated and in many cases not possible.

Thanks. That makes sense.
So how about they add a new native QB64PE command called MoveArrayElements(MyArray, SourceStartElementIndex, SourceEndElementIndex, DestIndex) that uses the memory method under the hood? Then the compiler does not need to try and determime what the source code is doing, it's now just a straightforward command.

(Or, I suppose we could create a user-defined function that does the same, with whatever checks to make sure the values are valid. Either way, in the spirt of BASIC, to keep life simple and save the programmer from having to worry about low level headaches like worrying about how many bytes a variable uses, etc. If we don't mind that low-level stuff, we might as well be coding in C!)
Reply


Messages In This Thread
RE: Question about _MEM blocks and arrays - by madscijr - 06-08-2025, 05:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  _Putimage Question. Pete 11 704 01-04-2026, 09:33 PM
Last Post: Pete
  Nice simple, I hope, question Mad Axeman 4 360 12-20-2025, 09:28 PM
Last Post: SMcNeill
Question Experimenting with a "StringList" type for simpler handling of string arrays/lists Heimdall 18 1,226 12-19-2025, 12:51 PM
Last Post: Heimdall
  NewBie Question niteflyer 2 345 11-06-2025, 07:11 PM
Last Post: Petr
  A Question About _MAPTRIANGLE Magdha 2 388 11-02-2025, 11:37 AM
Last Post: Magdha

Forum Jump:


Users browsing this thread: 1 Guest(s)