I have put the original procedures in a library and written a reasonable number more complete with a macro interface to allow quoted strings and return values on the same line. The benchmark is nearly identical to the earlier version and it appears to be at least competitive to higher level language variable length string arrays.
The system can handle both zero terminated strings and binary data of specified length and it has both complete file to array and reverse functions.
This is the benchmark for the system on my old dev box.
5 million element test
1329 ms array create
843 ms array load data
16 ms array read
2250 ms array delete
Press any key to continue ...
These is the macro function interface to the array system.
; ************************************************
; ALLOCATE and FREE a variable length string array
; ************************************************
arralloc$ MACRO member_count ;; create pointer array with empty members
arrealloc$ MACRO arr,indx ;; reallocate array to a different member count
arrfree$ MACRO arr ;; deallocate all members and pointer array
; ***************************
; write data to array members
; ***************************
arrset$ MACRO arr,indx,ptxt ;; write/overwrite zero terminated data to array member
arrbin$ MACRO arr,indx,psrc,lsrc ;; write/overwrite any data of specified length to member
arrfile$ MACRO file_name ;; load text file into array
arrtxt$ MACRO ptxt ;; load zero terminated text into array
; *****************************
; get data from an array member
; *****************************
arrget$ MACRO arr,indx ;; get the address of an array member
; **********************************
; get block data from a string array
; **********************************
arr2disk$ MACRO arr,file_name ;; write array directly to disk as a CRLF delimited file
arr2mem$ MACRO arr,pmem ;; write array with no CRLF to preallocated memory
arr2text$ MACRO arr,pmem ;; write array WITH a CRLF after each
; **************************************************
; get information about the array and/or its members
; **************************************************
arrlen$ MACRO arr,indx ;; get the stored length of an array member
arrcnt$ MACRO arr ;; get the member count
; ************************************************
; calculate memory storage size for complete array
; ************************************************
arrtotal$ MACRO arr:REQ,xtra2:VARARG ;; get the amount of memory to store whole array
; ********************************
; manually change the array length
; ********************************
arrtrunc$ MACRO arr,indx ;; truncate the array
arrextnd$ MACRO arr,indx ;; extend the array
About the only extra functions I can think of ar array insertion at a specified index and array deletion at a specified index, both of which require a pointer shuffle and a reallocation of the pointer array. I think it can be done reasonably quickly for a single insertion or deletion but to add or remove multiple entries of any quantity I think a dedicated procedure would need to be written so there is only one pointer allocation and one sequential pointer move operation.
If anyone has the time to have a play with this system it would be appreciated as i would like to get this capacity up and going in the masm32 project.
[attachment deleted by admin]