Closed SukkaW closed 3 months ago
Hi @SukkaW,
At the moment this is not possible but I wanted to point out that in your use-case, the only overhead you have is the call to getDomainWithoutSuffix
which consist in a single call to .slice
. This should be very fast and low-overhead. Is that a problem for your use-case?
Best,
@remusao
If I call both getDomain
and getSubdomain
on the same domain, anything before FLAG.SUB_DOMAIN
will be called twice:
extractHostname
for faster processing)detectIp
for faster processing)At the moment this is not possible but I wanted to point out that in your use-case, the only overhead you have is the call to
getDomainWithoutSuffix
which consist in a single call to.slice
. This should be very fast and low-overhead. Is that a problem for your use-case?
Yes, replacing the getDomain
and getSubdomain
with one single parse
call does improve the performance by about 30%, thanks!
Sounds good. I'll close this as resolved but feel free to open an issue if you'd need any other information of help.
In my use case, I only want to get the
domain
and thesubdomain
of a domain.I can simply do
tldts.getDomain()
and thentldts.getSubdomain()
, but the input domain would be parsed twice.Under the hood,
tldts-core
does haveFLAG
constants, but it is not exposed to thetldts
. On the other hand, thesuffixLookup
function is not exported so I can't build my ownparseDomainAndSubdomain
ontldts-core
directly.