Skip to content

Instantly share code, notes, and snippets.

@wezm
Last active November 15, 2023 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wezm/4043bde0dc2974c88b7706c60b58f900 to your computer and use it in GitHub Desktop.
Save wezm/4043bde0dc2974c88b7706c60b58f900 to your computer and use it in GitHub Desktop.

mandoc

OpenBSD

Using default CFLAGS (I.e. no -O2)

Before

openbsd$ time ./makewhatis -Tutf8 -n
    0m04.64s real     0m03.88s user     0m00.32s system
openbsd$ time ./makewhatis -Tutf8 -n
    0m03.88s real     0m03.63s user     0m00.25s system
openbsd$ time ./makewhatis -Tutf8 -n
    0m03.90s real     0m03.64s user     0m00.28s system

After

openbsd$ time ./makewhatis -Tutf8 -n
    0m02.59s real     0m02.38s user     0m00.22s system
openbsd$ time ./makewhatis -Tutf8 -n
    0m02.78s real     0m02.52s user     0m00.23s system
openbsd$ time ./makewhatis -Tutf8 -n
    0m02.76s real     0m02.54s user     0m00.27s system

Raspberry Pi 4

wmoore@raspberrypi:~/Documents/mandoc $ uname -a
Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux

Before

wmoore@raspberrypi:~/Documents/mandoc $ time ./makewhatis -Tutf8 -n

real	0m9.179s
user	0m7.019s
sys	0m0.410s
wmoore@raspberrypi:~/Documents/mandoc $ time ./makewhatis -Tutf8 -n

real	0m7.119s
user	0m6.816s
sys	0m0.301s
wmoore@raspberrypi:~/Documents/mandoc $ time ./makewhatis -Tutf8 -n

real	0m7.239s
user	0m6.949s
sys	0m0.289s

After

wmoore@raspberrypi:~/Documents/mandoc $ time ./makewhatis -Tutf8 -n

real	0m5.907s
user	0m5.687s
sys	0m0.220s
wmoore@raspberrypi:~/Documents/mandoc $ time ./makewhatis -Tutf8 -n

real	0m5.914s
user	0m5.681s
sys	0m0.232s
wmoore@raspberrypi:~/Documents/mandoc $ time ./makewhatis -Tutf8 -n

real	0m5.894s
user	0m5.670s
sys	0m0.224s

Torrent (Ryzen 9 7950X)

Before

 14:35  ~  Source  mandoc  time ./makewhatis -Tutf8 -n                                                                                             main
./makewhatis -Tutf8 -n  2.61s user 0.21s system 99% cpu 2.819 total
 14:35  ~  Source  mandoc  time ./makewhatis -Tutf8 -n                                                                                             main
./makewhatis -Tutf8 -n  2.67s user 0.17s system 99% cpu 2.841 total
 14:35  ~  Source  mandoc  time ./makewhatis -Tutf8 -n                                                                                             main
./makewhatis -Tutf8 -n  2.67s user 0.19s system 99% cpu 2.864 total

After

 14:35  ~  Source  mandoc  time ./makewhatis -Tutf8 -n                                                                                             perf
./makewhatis -Tutf8 -n  1.84s user 0.19s system 99% cpu 2.033 total
 14:35  ~  Source  mandoc  time ./makewhatis -Tutf8 -n                                                                                             perf
./makewhatis -Tutf8 -n  1.92s user 0.19s system 99% cpu 2.109 total
 14:35  ~  Source  mandoc  time ./makewhatis -Tutf8 -n                                                                                             perf
./makewhatis -Tutf8 -n  1.93s user 0.17s system 99% cpu 2.105 total

Failing Test

  • After while error we get to line_result & ROFF_MASK, which hits ROFF_IGN. This is the same on both branches
  • line_result & ROFF_APPEND = 0, so pos = 0
  • line_result & ROFF_USERCALL = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment