[ prog / sol / mona ]

prog


How can I run my own instance of this

65 2020-02-22 23:54

[2/2]
The time for fulltest fluctuates between 4 and 5 centiseconds, but since the homepage has:

Runs well on "el cheapo" VPS

I recommend both regex refinements as well. To integrate with filter-func, here is a diff against the current gitlab version, which is the last commit of "20 Feb, 2020". This one is untested because I do not yet have a local instance, but it is simple enough that it should work.

$ TZ=GMT diff -u schemebbs/bbs.scm edit/bbs.scm
--- schemebbs/bbs.scm	2020-02-20 15:17:38.682224678 +0000
+++ edit/bbs.scm	2020-02-22 14:41:02.198743998 +0000
@@ -138,10 +138,12 @@
            (let* ((t (call-with-input-file path read))
                   (headline (lookup-def 'headline t))
                   (posts (lookup-def 'posts t))
-                  (filter-func (if (default-object? range)
-                                   identity
-                                   (lambda (e) (member (car e) (posts-range range))))))
-             (cond ((default-object? range)
+                  (norange (default-object? range))
+                  (rangeonce (if norange "unused" (posts-range range)))
+                  (filter-func (if norange
+                                   (lambda (e) #t)
+                                   (lambda (e) (vector-ref rangeonce (car e))))))
+             (cond (norange
                  (if (not (file-exists? cache))
                      (write-and-serve cache (thread-template board thread posts headline filter-func))
                      (begin (display "reverse proxy miss") (serve-file cache)))) ;; we shouldn't go here, reverse proxy fetches the page itself

Here are the two regex refinements for digit count >>47 and interval count >>49. The SYNCs are there for grep. The irregex PCRE ranges are linked in >>47.

$ TZ=GMT diff -u schemebbs/bbs.scm edit/bbs.scm
--- schemebbs/bbs.scm	2020-02-20 15:17:38.682224678 +0000
+++ edit/bbs.scm	2020-02-22 15:40:23.041388774 +0000
@@ -153,7 +153,9 @@
 
 
 (define (range? posts)
-  (irregex-match "([1-9][0-9]*|([1-9][0-9]*)-([1-9][0-9]*))(,([1-9][0-9]*|([1-9][0-9]*-[1-9][0-9]*)))*" posts))
+  (irregex-match "(([1-9][0-9]{0,2})|(([1-9][0-9]{0,2})-([1-9][0-9]{0,2})))(,(([1-9][0-9]{0,2})|(([1-9][0-9]{0,2})-([1-9][0-9]{0,2})))){0,11}" posts))
+  ; SYNC lib/markup.scm:quotelink
+  ; SYNC digit count of *max-posts*
 
 (define (posts-range range)
   (define (expand-range x)
$ TZ=GMT diff -u schemebbs/lib/markup.scm edit/lib/markup.scm
--- schemebbs/lib/markup.scm	2020-02-20 15:17:38.682224678 +0000
+++ edit/lib/markup.scm	2020-02-22 15:38:37.134770741 +0000
@@ -182,7 +182,8 @@
 (define quotelink
   (transform-rule
     'quotelink
-    (irregex ">>([1-9][0-9]*|([1-9][0-9]*)-([1-9][0-9]*))(,([1-9][0-9]*|([1-9][0-9]*-[1-9][0-9]*)))*")
+    (irregex ">>(([1-9][0-9]{0,2})|(([1-9][0-9]{0,2})-([1-9][0-9]{0,2})))(,(([1-9][0-9]{0,2})|(([1-9][0-9]{0,2})-([1-9][0-9]{0,2})))){0,11}")
+    ; SYNC bbs.scm:range?
     (lambda (sub) `(a (@ (href ,(string-append
                                   "/" *board*
                                   "/" *thread*

With all of the above applied, the maximum stress that can be put on posts-range is:

1 ]=> (define maxtest (apply string-append (cons "1-300" (make-list 11 ",1-300"))))
1 ]=> (posts-range maxtest)

which runs in zero time.
>>1-300,1-300,1-300,1-300,1-300,1-300,1-300,1-300,1-300,1-300,1-300,1-300
If the server machine is an honest-to-God potato, the 11 can be further reduced.

301


VIP:

do not edit these