This might be easier on your processor
Presuming:
e = entity name
ent = list of entity data
blist = list of bulges
plist = list of vertex points
dlist = list of distances (from 0) of each vertex
dseglist = list of segment distances
(setq blist (mapcar 'cdr (vl-remove-if-not '(lambda (x)(= (car x) 42)) ent)))
(setq plist (mapcar 'cdr (vl-remove-if-not '(lambda (x)(= (car x) 10)) ent)))
(setq dlist (mapcar '(lambda (x)(vlax-curve-getdistatpoint e x)) plist))
(setq copy dlist dseglist nil)
(repeat (1- (length dlist)) (setq dseglist (cons (- (cadr copy)(car copy)) dseglist) copy (cdr copy)))
Of course if dseglist is localized, you don't have to set it to nil.
Just gotta take care of closed polylines.