edward

An extensible POSIX-compatible implementation of the ed(1) text editor

git clone https://git.8pit.net/edward.git

 1(import (edward ed editor)
 2        (edward ed addr))
 3
 4(define-bench (editor-regex-match-line)
 5  (let ((e (make-text-editor #f "" "" #f))
 6        (n 100000))
 7    (editor-append! e 0 (generate-list random-string n))
 8    (editor-append! e n '("bla bla 23foobar42 foo bar"))
 9
10    (range->lpair e
11      (make-range (make-addr '(regex-forward . "[0-9][0-9]*foobar[0-9][0-9]* foo"))))))
12
13(define-bench (editor-get-lines-partial)
14  (let ((e (make-text-editor #f "" "" #f))
15        (n 100000))
16    (editor-append! e 0 (generate-list random-string n))
17    (editor-get-lines e (cons 0 (/ n 2)))))
18
19(define-bench (editor-get-line-number-last)
20  (let ((e (make-text-editor #f "" "" #f))
21        (n 100000))
22    (editor-append! e 0 (generate-list random-string n))
23    (let ((p (editor-get-lines e (cons n n))))
24      (editor-get-lnum e (car p)))))