Done! I'm pretty happy that my hashmap routines are working. I can access elements in 3.5ms vs 300ms. My computer is junky so these are pretty bad times but the magnitude changes are enough to make me happy that writing the hashmaps logic was worthwhile.
I think I could get some speedups if I move the MAP.GET logic into a internal subroutine. I may do this for rendering routine but it is an optimization that may not matter.
Here is the test routine, this is using an already built hashmap:
*
OPEN '','CONTROL-FILE' TO CONTROL.FILE ELSE
PRINT 'Unable to open file: CONTROL-FILE - Press RETURN':
INPUT ANYTHING
STOP
END
*
EQU MAP.SIZE TO 50000
DIM MAP(MAP.SIZE)
MAT MAP = ''
*
READ WORDS.MATRIX FROM CONTROL.FILE,'WORDS.MAP' ELSE WORDS.MATRIX = ''
MATPARSE MAP FROM WORDS.MATRIX
*
T3 = TIME()
CALL MAP.GET(MAT MAP,MAP.SIZE,'alpaca',VALUE)
T4 = TIME()
*
T = T4 - T3
T = T * 10000
*
PRINT 'Value: ' : VALUE
*
PRINT 'Took: ' : T : 'ms'
*
Unfortunately the programmer needs to be aware of the low level size aspect of the hashmap. I would like to get the size of a dimensioned array somehow so that it doesn't need to get passed into MAP.GET and MAP.SET.