# Topic "popular links" panel domain extraction doesn't handle country TLDs

**URL:** <https://meta.discourse.org/t/topic-popular-links-panel-domain-extraction-doesnt-handle-country-tlds/60156>\
**Category:** Bug\
**Created:** [March 30, 2017, 4:32am UTC](https://meta.discourse.org/t/topic-popular-links-panel-domain-extraction-doesnt-handle-country-tlds/60156 "2017-03-30T04:32:15Z")\
**Posts on this page:** 1\
**Showing post:** 41

<div class="post-metadata">

**Author:** ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)\
**Post date:** [November 28, 2017, 11:46am UTC](https://meta.discourse.org/t/topic-popular-links-panel-domain-extraction-doesnt-handle-country-tlds/60156/41 "2017-11-28T11:46:05Z")

</div>

I built [mini\_suffix](https://github.com/discourse/mini_suffix) today which is a super simple wrapper around [libpsl](https://github.com/rockdaboot/libpsl/tree/libpsl-0.19.1). Currently, it only exposes `psl_registrable_domain` for now because that is all we need.

### Benchmarks

> <https://github.com/discourse/mini_suffix/blob/main/benchmark/bench.rb>

```plaintext
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.

---

_[View the full topic](https://meta.discourse.org/t/topic-popular-links-panel-domain-extraction-doesnt-handle-country-tlds/60156)._
