Way too imperative. Tons of undeclared variables. why is 'modo' a macro? Local 'defvar'.
Try to write the code shorter. You should be able to write it in about 50%.
Example, from 6 to 3 lines:
; generate a random list of *max-int* integers
(defun randlist (size)
(let ((lst ()))
(dotimes (i size)
(setf lst (cons (random *max-int*) lst)))
lst))
vs.
(defun random-vector (size)
"generate a random vector of *max-int* integers"
(map-into (make-array size) (lambda () (random *max-int*))))
and
; generate random data
(defun gen (size-string)
(when (null size-string)
(setf size-string "4096"))
(setf size (parse-integer size-string :junk-allowed t))
(unless (numberp size)
(error "size must be a number"))
(defvar buffer (randlist size))
(princ (%octets-to-string (coerce buffer 'vector) *encoding*)))
Also, I'm not sure what (specifically) read-line looks for to stop reading, but if it can occur randomly you could receive errors if this first random new-line occurs before the length of the file's first line. Or at all when using the same pad for many files as you describe. This may be handled by your %octets-to-string handler though.
2 comments
[ 3.3 ms ] story [ 15.3 ms ] threadTry to write the code shorter. You should be able to write it in about 50%.
Example, from 6 to 3 lines:
vs. and vs.