Skip to content

Commit

Permalink
update benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotwutingfeng committed May 30, 2022
1 parent 77d9402 commit adc05c6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
35 changes: 17 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ fmt.Println(res.SubDomain) // a.long.subdomain
fmt.Println(res.Domain) // ox
fmt.Println(res.Suffix) // ac.uk
fmt.Println(res.RegisteredDomain) // ox.ac.uk
fmt.Println(res.Port) // 5000
fmt.Println(res.Path) // /a/b/c/d/e/f/g/h/i?id=42
fmt.Println(res.Port) // 5000
fmt.Println(res.Path) // /a/b/c/d/e/f/g/h/i?id=42
```

### IPv4 Address
Expand Down Expand Up @@ -304,11 +304,11 @@ Benchmarks performed on AMD Ryzen 7 5800X, Manjaro Linux.

| Benchmark Name | Iterations | ns/op | B/op | allocs/op | Fastest |
|----------------------|------------|-------------|----------|-------------|--------------------|
| GoFastTld | 2341306 | 511.3 ns/op | 144 B/op | 2 allocs/op | |
| JPilloraGoTld | 2428166 | 491.0 ns/op | 224 B/op | 2 allocs/op | :heavy_check_mark: |
| JoeGuoTldExtract | 2360973 | 505.6 ns/op | 160 B/op | 5 allocs/op | |
| Mjd2021USATldExtract | 1452428 | 834.7 ns/op | 208 B/op | 7 allocs/op | |
| M507Tlde | 2430883 | 492.8 ns/op | 160 B/op | 5 allocs/op | |
| GoFastTld | 2252775 | 537.1 ns/op | 144 B/op | 2 allocs/op | |
| JPilloraGoTld | 2421658 | 497.3 ns/op | 224 B/op | 2 allocs/op | :heavy_check_mark: |
| JoeGuoTldExtract | 2336356 | 501.1 ns/op | 160 B/op | 5 allocs/op | |
| Mjd2021USATldExtract | 1342712 | 830.7 ns/op | 208 B/op | 7 allocs/op | |
| M507Tlde | 2406886 | 506.4 ns/op | 160 B/op | 5 allocs/op | |

---

Expand All @@ -318,11 +318,11 @@ Benchmarks performed on AMD Ryzen 7 5800X, Manjaro Linux.

| Benchmark Name | Iterations | ns/op | B/op | allocs/op | Fastest |
|----------------------|------------|-------------|----------|-------------|--------------------|
| GoFastTld | 2404617 | 474.8 ns/op | 144 B/op | 2 allocs/op | :heavy_check_mark: |
| JPilloraGoTld | 1615161 | 718.2 ns/op | 224 B/op | 2 allocs/op | |
| JoeGuoTldExtract | 2151549 | 553.1 ns/op | 272 B/op | 5 allocs/op | |
| Mjd2021USATldExtract | 1495000 | 798.9 ns/op | 288 B/op | 6 allocs/op | |
| M507Tlde | 2145702 | 554.7 ns/op | 272 B/op | 5 allocs/op | |
| GoFastTld | 2360563 | 499.6 ns/op | 144 B/op | 2 allocs/op | :heavy_check_mark: |
| JPilloraGoTld | 1651546 | 728.8 ns/op | 224 B/op | 2 allocs/op | |
| JoeGuoTldExtract | 2154034 | 549.6 ns/op | 272 B/op | 5 allocs/op | |
| Mjd2021USATldExtract | 1497088 | 801.8 ns/op | 288 B/op | 6 allocs/op | |
| M507Tlde | 2148830 | 554.8 ns/op | 272 B/op | 5 allocs/op | |

---

Expand All @@ -332,19 +332,18 @@ Benchmarks performed on AMD Ryzen 7 5800X, Manjaro Linux.

| Benchmark Name | Iterations | ns/op | B/op | allocs/op | Fastest |
|----------------------|------------|-------------|-----------|-------------|--------------------|
| GoFastTld | 2195161 | 548.4 ns/op | 144 B/op | 2 allocs/op | :heavy_check_mark: |
| JPilloraGoTld | 404686 | 2753 ns/op | 928 B/op | 4 allocs/op | |
| JoeGuoTldExtract | 844623 | 1327 ns/op | 1120 B/op | 6 allocs/op | |
| Mjd2021USATldExtract | 813936 | 1354 ns/op | 1120 B/op | 6 allocs/op | |
| M507Tlde | 820394 | 1326 ns/op | 1120 B/op | 6 allocs/op | |
| GoFastTld | 2185510 | 546.8 ns/op | 144 B/op | 2 allocs/op | :heavy_check_mark: |
| JPilloraGoTld | 387694 | 2740 ns/op | 928 B/op | 4 allocs/op | |
| JoeGuoTldExtract | 801040 | 1349 ns/op | 1120 B/op | 6 allocs/op | |
| Mjd2021USATldExtract | 768145 | 1327 ns/op | 1120 B/op | 6 allocs/op | |
| M507Tlde | 889660 | 1339 ns/op | 1120 B/op | 6 allocs/op | |

---

## Acknowledgements

- [fasttld (Python)](https://github.com/jophy/fasttld)
- [tldextract (Python)](https://github.com/john-kurkowski/tldextract)
- [tldextract (Go)](https://github.com/mjd2021usa/tldextract)
- [IETF RFC 2396](https://www.ietf.org/rfc/rfc2396.txt)
- [IETF RFC 3490](https://www.ietf.org/rfc/rfc3490.txt)
- [IETF RFC 3986](https://www.ietf.org/rfc/rfc3986.txt)
4 changes: 2 additions & 2 deletions strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func lastIndexAny(s string, chars string) int {
for i := len(s); i > 0; {
r, size := utf8.DecodeLastRuneInString(s[0:i])
i -= size
if strings.IndexRune(chars, r) >= 0 {
if strings.IndexRune(chars, r) != -1 {
return i
}
}
Expand Down Expand Up @@ -147,7 +147,7 @@ func formatAsPunycode(s string) string {
// where all runes in toBeReplaced are to be
// replaced by toReplaceWith
func makeNewReplacerParams(toBeReplaced string, toReplaceWith string) []string {
var params = make([]string, 8)
var params = make([]string, len(toBeReplaced))
for _, r := range toBeReplaced {
params = append(params, string(r), toReplaceWith)
}
Expand Down

0 comments on commit adc05c6

Please sign in to comment.