I built mini_suffix today which is a super simple wrapper around libpsl. Currently, it only exposes psl_registrable_domain for now because that is all we need.
Benchmarks
PublicSuffix.domain total allocated memsize: 6574255
PublicSuffix.domain total retained memsize: 1133266
MiniSuffix.domain total allocated memsize: 8000
MiniSuffix.domain total retained memsize: 0
Warming up --------------------------------------
PublicSuffix.domain 4.503k i/100ms
MiniSuffix.domain 77.107k i/100ms
Calculating -------------------------------------
PublicSuffix.domain 47.521k (± 2.2%) i/s - 238.659k in 5.024541s
MiniSuffix.domain 875.595k (± 3.8%) i/s - 4.395M in 5.027237s
Comparison:
MiniSuffix.domain: 875594.7 i/s
PublicSuffix.domain: 47521.2 i/s - 18.43x slower
As this introduces a dependency on libpsl, I’ll need to introduce libpsl to our base image first before I can add mini_suffix to Discourse and use it.