- Racket 51.4%
- Go 48.5%
Inspired by https://github.com/layeh/kjv and https://github.com/lukesmithxyz/kjv
To Use
-
jpm --no-core quickbin verse-reader.janet build/kjvbuilds -
build/kjv gen 1:1to show verse. It shows full books, allows partial names phil, matt etc. -
racket interpreted-bible-parse.rkt gen 1to validate new data. #ToDo: Move data Cleaning to Janet. #Todo File's currently hardcoded, have both versions accept a file argument and and use that for program name, usage etc.
To Do
- many #ToDo:s littered about in
bible-parse.rkt, which should also be ported to Janet. - add binaries and old books with verses
- change BoM etc. abbreviations to remove spaces: 1 ne -> 1ne
Texts
From layeh:
- Clementine Vulgate
- O.T. Septuagint and SBL Greek New Testament
From Luke Smith:
- KJV + Apocrophya (n.b. I eliminated 1 line in Sirach: "A Prayer to...")
From Mormon Documentation Project:
- Book of Mormon (and soon others) (n.b. Nephi 3 and 4 are corrupted in almost all online sources; my initial attempts to scrape the whole book failed here too. I was able to easily fix the .csv here though!)
Performance
With hyperfine:
| time | user | sys | size (MB) | |
|---|---|---|---|---|
| Janet (ugly string blob, verse-reader.janet) | 5.4 ms ± 0.4 ms | 3.9 ms | 1.4 ms | 6.8 |
Janet (arrays commit: f398e3ce) |
8.5 ms ± 0.5 ms | 5.7 ms | 2.8 ms | 6.7 |
Janet (my favorite, commit: e8b9990201) |
13.6 ms ± 0.6 ms | 8.3 ms | 3.2 ms | 6.8 |
| Janet (My first Janet program) | 47.4 ms ± 3.5 ms | 38.1 ms | 9.7 ms | 7.1 |
| Last Racket | 222.1 ms ± 2.9 ms | 168.9 ms | 52.6 ms | 55 |
Common Lisp bible-parse.lisp |
10.0 ms ± 2.3 ms | 6.5 ms | 3.8 ms | 63.6 |
| Golang with embed (commit) | 30.8 ms ± 2.4 ms | 34.1 ms | 10.8 ms | 7.6 |
Golang bible-parse.go data structs in file |
3.6 ms ± 1.1 ms | 1.3 ms | 2.1 ms | 9.1 |
| My Comp. parse | 268.6 ms ± 10.4 ms | 207.4 ms | 61.3 ms | 54 |
| Ryan's Comp. parse | 275.3 ms ± 10.3 ms | 221.5 ms | 53.9 ms | 56 |
| Ryan's lines | 798.6 ms ± 21.1 ms | 727.5 ms | 70.7 ms | 55.2 |
| Interp. | 647.2 ms ± 6.0 ms | 608.2 ms | 43.8 ms | |
| reference | 158.2 ms ± 33.5 ms | 203.3 ms | 29.8 ms | 1.6 |
| Corbas' Chicken version | 12.7.2 ms ± 3.2 ms | 8.6 ms | 4.4 ms | 7.1 |
1.11.24 with time:
| real | user | sys | size (MB) | |
|---|---|---|---|---|
| current (bookless) | 0.285s | 0.229s | 0.056s | 11.43 |
| reference | 0.114s | 0.139s | 0.023s | |
| Interp. | 0.757s | 0.683s | 0.074s | |
| R. lines | 0.777s | 0.704s | 0.074s | |
| R.comp. parse | 0.293s | 0.234s | 0.064s | 12 |
| My comp. parse | 0.292s | 0.216s | 0.076s | 12 |
- current:
time ./kjvr gen 1 - reference in bash/awk:
time PAGER=cat kjv gen 1 - interpreted with file:
time racket interpreted-bible-parse.rkt gen 1 - Ryan's line version note, extremely fast fast compilation!
- Ryan's comp parse version, 3-4s compilation and great execution. Now the base.
- my old comp time attempt without
#:prefab
For Racket
-
raco exe -o kjv bible-parse.rktbuilds -
./kjv gen 1:1to show verse. It shows full books, allows partial names phil, matt etc. -
racket interpreted-bible-parse.rkt gen 1to validate new data. #ToDo: File's currently hardcoded, have both versions accept a file argument and and use that for program name, usage etc.
min-test.rkt (basically a hello world) gets Time (mean ± σ): 86.8 ms ± 2.8 ms [User: 61.5 ms, System: 25.1 ms] so the current's 220ms is only 3x slower than Racket's fastest. My various refactors had identical performance, although inline-test.rkt compiles faster to an only 51mb static binary. Racket packs everything into an ELF container, which apparently takes 80ms to initialize, I don't yet understand why Typed Racket has a slower initialization.
| Data Cleaners | time | user | sys | size (MB) |
|---|---|---|---|---|
| lds-scrip-extractor.rkt w/ optimizations --cs | 1.062 s ± 0.013 s | 1.004 s | 00.057 s | 9.4 |
| lds-scrip-extractor.rkt | 1.843 s ± 0.724 s | 1.730 s | 0.104 s | 12.1 |
| lds-scrip-extractor.rkt --orig-exe --cs | 1.080 s ± 0.022 s | 1.024 s | 0.057 s | 55.3 |
| lds-scrip-extractor.lisp | 393.8 ms ± 53.4 ms | 291.2 ms | 44.4 ms | 39.8 |
| lds-scrip-extractor.lisp (speed 3) (safety 0) | 287.1 ms ± 32.5 ms | 188.6 ms | 25.2 ms | 39.7 |