I have information coming in as a list in the form '(0 30 55 200 0 1) and I have a reference in a similar format.
I need to match the contents of my known lists with the new list which has just arrived. And, it needs to be very fast.
Thanks to Lutz (and others), I have come up with a good solution, but I need it to be faster.
Starting with the reference lists
Code: Select all
(dolist (s (sequence 1 100))
(set 'n (rand 255 (rand 100)))
(push n e -1)
)
Code: Select all
(set 'f (rand 255 100)) ; create a new list
(push (e (rand (length e))) f) ; grab from 'e above and push into our list
Code: Select all
(set 'eh (map (fn (l) (pack (dup "b" (length l)) l)) e)) ; convert to hex (much faster!)
;
(set 'hex (pack (dup "b" (length f)) f))
(clean nil? (map (fn (s) (find s hex)) eh))
;> (n) ; where n is the location found
;
(time (clean nil? (map (fn (s) (find s hex)) eh)))
;> ~ 1ms ; this is too slow
Any thoughts would be appreciated.