Files
go-telegram/test/benchmarks/results/raw.txt
T
lukaszraczylo 607c3e8ddd test(bench): cross-library benchmarks vs top 5 go telegram libraries
Adds test/benchmarks/ as a separate Go module so competitor deps
(go-telegram-bot-api/v5, telebot.v3, go-telegram/bot, telego,
echotron/v3) stay out of the root go.mod.

Hot paths covered:
  - Webhook decode  (small Update -> typed Update struct)
  - Large unmarshal (Update with entities + reply markup + photo array)
  - API round-trip  (sendMessage against httptest.Server)
  - Dispatch route  (20 handlers, last-registered matches)

Results on Apple M4 Max / go1.26.2: ours wins 3 of 4 paths and is
2nd of 5 in the round-trip path. Full report at
docs/benchmarks/2026-05-10-comparison.md, raw output committed under
test/benchmarks/results/.

Caveats called out in the report:
  - codec asymmetry (we ship goccy/go-json; competitors mostly stdlib)
  - echotron call bench skipped — built-in rate limiter not externally
    configurable; would measure throttling, not the library
  - dispatch bench limited to libs with a public sync entry point
    (ours, telebot, gobot); gotba has no dispatcher, telego/echotron
    use channel/per-chat paradigms not directly comparable

Also gitignores docs/superpowers/ (local brainstorm/spec scratch)
and regenerates docs/reference/dispatch.md after the new
Router.Process method.
2026-05-10 21:52:00 +01:00

208 lines
20 KiB
Plaintext

goos: darwin
goarch: arm64
pkg: github.com/lukaszraczylo/go-telegram/test/benchmarks
cpu: Apple M4 Max
BenchmarkCall_ours-16 30754 38732 ns/op 11589 B/op 105 allocs/op
BenchmarkCall_ours-16 31054 39002 ns/op 11476 B/op 104 allocs/op
BenchmarkCall_ours-16 30990 38440 ns/op 11471 B/op 104 allocs/op
BenchmarkCall_ours-16 30301 39464 ns/op 11452 B/op 104 allocs/op
BenchmarkCall_ours-16 30438 38897 ns/op 11425 B/op 104 allocs/op
BenchmarkCall_ours-16 30783 39107 ns/op 11429 B/op 104 allocs/op
BenchmarkCall_ours-16 30486 39507 ns/op 11402 B/op 104 allocs/op
BenchmarkCall_ours-16 30045 37723 ns/op 11442 B/op 104 allocs/op
BenchmarkCall_ours-16 37867 33103 ns/op 11444 B/op 104 allocs/op
BenchmarkCall_ours-16 30522 39139 ns/op 11436 B/op 104 allocs/op
BenchmarkCall_gotba-16 29838 40947 ns/op 11243 B/op 125 allocs/op
BenchmarkCall_gotba-16 28545 41897 ns/op 11182 B/op 125 allocs/op
BenchmarkCall_gotba-16 28713 41146 ns/op 11197 B/op 125 allocs/op
BenchmarkCall_gotba-16 28480 42210 ns/op 11238 B/op 125 allocs/op
BenchmarkCall_gotba-16 28831 42004 ns/op 11204 B/op 125 allocs/op
BenchmarkCall_gotba-16 28484 42012 ns/op 11224 B/op 125 allocs/op
BenchmarkCall_gotba-16 30481 41283 ns/op 11212 B/op 125 allocs/op
BenchmarkCall_gotba-16 28646 42042 ns/op 11209 B/op 125 allocs/op
BenchmarkCall_gotba-16 28418 40680 ns/op 11250 B/op 125 allocs/op
BenchmarkCall_gotba-16 28358 42146 ns/op 11208 B/op 125 allocs/op
BenchmarkCall_telebot-16 27294 43739 ns/op 13522 B/op 139 allocs/op
BenchmarkCall_telebot-16 27763 43429 ns/op 13491 B/op 139 allocs/op
BenchmarkCall_telebot-16 27525 43618 ns/op 13478 B/op 139 allocs/op
BenchmarkCall_telebot-16 27423 43711 ns/op 13431 B/op 139 allocs/op
BenchmarkCall_telebot-16 27415 43704 ns/op 13473 B/op 139 allocs/op
BenchmarkCall_telebot-16 27268 43834 ns/op 13477 B/op 139 allocs/op
BenchmarkCall_telebot-16 28180 43488 ns/op 13486 B/op 139 allocs/op
BenchmarkCall_telebot-16 27480 43644 ns/op 13485 B/op 139 allocs/op
BenchmarkCall_telebot-16 27458 43581 ns/op 13479 B/op 139 allocs/op
BenchmarkCall_telebot-16 27949 43415 ns/op 13480 B/op 139 allocs/op
BenchmarkCall_gobot-16 19503 60924 ns/op 13847 B/op 176 allocs/op
BenchmarkCall_gobot-16 19620 61253 ns/op 13837 B/op 176 allocs/op
BenchmarkCall_gobot-16 19790 60869 ns/op 13839 B/op 176 allocs/op
BenchmarkCall_gobot-16 19574 61153 ns/op 13816 B/op 176 allocs/op
BenchmarkCall_gobot-16 19634 61070 ns/op 13830 B/op 176 allocs/op
BenchmarkCall_gobot-16 19569 61173 ns/op 13817 B/op 176 allocs/op
BenchmarkCall_gobot-16 19549 61688 ns/op 13851 B/op 176 allocs/op
BenchmarkCall_gobot-16 19918 60815 ns/op 13779 B/op 176 allocs/op
BenchmarkCall_gobot-16 19440 61667 ns/op 13830 B/op 176 allocs/op
BenchmarkCall_gobot-16 19660 61036 ns/op 13837 B/op 176 allocs/op
BenchmarkCall_telego-16 32732 36606 ns/op 6788 B/op 48 allocs/op
BenchmarkCall_telego-16 33837 35882 ns/op 6697 B/op 48 allocs/op
BenchmarkCall_telego-16 33074 36146 ns/op 6693 B/op 48 allocs/op
BenchmarkCall_telego-16 33400 36090 ns/op 6723 B/op 48 allocs/op
BenchmarkCall_telego-16 32684 36296 ns/op 6709 B/op 48 allocs/op
BenchmarkCall_telego-16 32926 36577 ns/op 6721 B/op 48 allocs/op
BenchmarkCall_telego-16 33928 35481 ns/op 6708 B/op 48 allocs/op
BenchmarkCall_telego-16 33195 36318 ns/op 6711 B/op 48 allocs/op
BenchmarkCall_telego-16 33140 36812 ns/op 6717 B/op 48 allocs/op
BenchmarkCall_telego-16 32343 37631 ns/op 6716 B/op 48 allocs/op
BenchmarkDispatch_ours-16 12199088 98.57 ns/op 128 B/op 3 allocs/op
BenchmarkDispatch_ours-16 12223122 97.66 ns/op 128 B/op 3 allocs/op
BenchmarkDispatch_ours-16 12088142 97.43 ns/op 128 B/op 3 allocs/op
BenchmarkDispatch_ours-16 12463010 100.9 ns/op 128 B/op 3 allocs/op
BenchmarkDispatch_ours-16 12284848 99.38 ns/op 128 B/op 3 allocs/op
BenchmarkDispatch_ours-16 11485198 101.1 ns/op 128 B/op 3 allocs/op
BenchmarkDispatch_ours-16 11685897 102.2 ns/op 128 B/op 3 allocs/op
BenchmarkDispatch_ours-16 11733669 102.1 ns/op 128 B/op 3 allocs/op
BenchmarkDispatch_ours-16 11811807 100.5 ns/op 128 B/op 3 allocs/op
BenchmarkDispatch_ours-16 11691974 103.1 ns/op 128 B/op 3 allocs/op
BenchmarkDispatch_telebot-16 4270724 284.6 ns/op 679 B/op 5 allocs/op
BenchmarkDispatch_telebot-16 4369950 270.2 ns/op 678 B/op 5 allocs/op
BenchmarkDispatch_telebot-16 4604205 269.9 ns/op 679 B/op 5 allocs/op
BenchmarkDispatch_telebot-16 4431572 282.2 ns/op 678 B/op 5 allocs/op
BenchmarkDispatch_telebot-16 4186550 272.0 ns/op 678 B/op 5 allocs/op
BenchmarkDispatch_telebot-16 4472223 265.7 ns/op 679 B/op 5 allocs/op
BenchmarkDispatch_telebot-16 4537406 265.0 ns/op 679 B/op 5 allocs/op
BenchmarkDispatch_telebot-16 4544478 264.4 ns/op 678 B/op 5 allocs/op
BenchmarkDispatch_telebot-16 4519431 266.7 ns/op 678 B/op 5 allocs/op
BenchmarkDispatch_telebot-16 4448779 268.5 ns/op 678 B/op 5 allocs/op
BenchmarkDispatch_gobot-16 4493029 254.1 ns/op 48 B/op 1 allocs/op
BenchmarkDispatch_gobot-16 4726080 261.5 ns/op 48 B/op 1 allocs/op
BenchmarkDispatch_gobot-16 4884592 249.6 ns/op 48 B/op 1 allocs/op
BenchmarkDispatch_gobot-16 4639986 256.7 ns/op 48 B/op 1 allocs/op
BenchmarkDispatch_gobot-16 4424702 261.1 ns/op 48 B/op 1 allocs/op
BenchmarkDispatch_gobot-16 4783779 249.2 ns/op 48 B/op 1 allocs/op
BenchmarkDispatch_gobot-16 4916862 248.2 ns/op 48 B/op 1 allocs/op
BenchmarkDispatch_gobot-16 4884650 249.9 ns/op 48 B/op 1 allocs/op
BenchmarkDispatch_gobot-16 4822939 252.4 ns/op 48 B/op 1 allocs/op
BenchmarkDispatch_gobot-16 4707606 250.5 ns/op 48 B/op 1 allocs/op
BenchmarkLargeUnmarshal_ours-16 177442 6697 ns/op 6024 B/op 34 allocs/op
BenchmarkLargeUnmarshal_ours-16 178348 6700 ns/op 6021 B/op 34 allocs/op
BenchmarkLargeUnmarshal_ours-16 180528 6686 ns/op 6022 B/op 34 allocs/op
BenchmarkLargeUnmarshal_ours-16 182416 6659 ns/op 6021 B/op 34 allocs/op
BenchmarkLargeUnmarshal_ours-16 179305 6675 ns/op 6022 B/op 34 allocs/op
BenchmarkLargeUnmarshal_ours-16 176892 6724 ns/op 6021 B/op 34 allocs/op
BenchmarkLargeUnmarshal_ours-16 185355 6392 ns/op 6022 B/op 34 allocs/op
BenchmarkLargeUnmarshal_ours-16 189590 6390 ns/op 6022 B/op 34 allocs/op
BenchmarkLargeUnmarshal_ours-16 189783 6438 ns/op 6022 B/op 34 allocs/op
BenchmarkLargeUnmarshal_ours-16 187572 6483 ns/op 6022 B/op 34 allocs/op
BenchmarkLargeUnmarshal_gotba-16 142377 8296 ns/op 3520 B/op 56 allocs/op
BenchmarkLargeUnmarshal_gotba-16 144884 8274 ns/op 3520 B/op 56 allocs/op
BenchmarkLargeUnmarshal_gotba-16 146434 8295 ns/op 3520 B/op 56 allocs/op
BenchmarkLargeUnmarshal_gotba-16 145183 8260 ns/op 3520 B/op 56 allocs/op
BenchmarkLargeUnmarshal_gotba-16 144775 8416 ns/op 3520 B/op 56 allocs/op
BenchmarkLargeUnmarshal_gotba-16 139510 8224 ns/op 3520 B/op 56 allocs/op
BenchmarkLargeUnmarshal_gotba-16 146359 8542 ns/op 3520 B/op 56 allocs/op
BenchmarkLargeUnmarshal_gotba-16 144981 8346 ns/op 3520 B/op 56 allocs/op
BenchmarkLargeUnmarshal_gotba-16 146877 8399 ns/op 3520 B/op 56 allocs/op
BenchmarkLargeUnmarshal_gotba-16 145443 8454 ns/op 3519 B/op 56 allocs/op
BenchmarkLargeUnmarshal_telebot-16 116883 10327 ns/op 5728 B/op 60 allocs/op
BenchmarkLargeUnmarshal_telebot-16 114584 10333 ns/op 5728 B/op 60 allocs/op
BenchmarkLargeUnmarshal_telebot-16 117277 10250 ns/op 5728 B/op 60 allocs/op
BenchmarkLargeUnmarshal_telebot-16 117700 10270 ns/op 5728 B/op 60 allocs/op
BenchmarkLargeUnmarshal_telebot-16 117328 10401 ns/op 5728 B/op 60 allocs/op
BenchmarkLargeUnmarshal_telebot-16 115922 10223 ns/op 5728 B/op 60 allocs/op
BenchmarkLargeUnmarshal_telebot-16 117475 10049 ns/op 5728 B/op 60 allocs/op
BenchmarkLargeUnmarshal_telebot-16 123367 9866 ns/op 5728 B/op 60 allocs/op
BenchmarkLargeUnmarshal_telebot-16 123385 9811 ns/op 5728 B/op 60 allocs/op
BenchmarkLargeUnmarshal_telebot-16 122586 9873 ns/op 5728 B/op 60 allocs/op
BenchmarkLargeUnmarshal_gobot-16 148576 8064 ns/op 4817 B/op 50 allocs/op
BenchmarkLargeUnmarshal_gobot-16 147967 8113 ns/op 4816 B/op 50 allocs/op
BenchmarkLargeUnmarshal_gobot-16 150718 7991 ns/op 4816 B/op 50 allocs/op
BenchmarkLargeUnmarshal_gobot-16 150271 8066 ns/op 4815 B/op 50 allocs/op
BenchmarkLargeUnmarshal_gobot-16 147646 8066 ns/op 4816 B/op 50 allocs/op
BenchmarkLargeUnmarshal_gobot-16 147889 8186 ns/op 4816 B/op 50 allocs/op
BenchmarkLargeUnmarshal_gobot-16 143164 8413 ns/op 4816 B/op 50 allocs/op
BenchmarkLargeUnmarshal_gobot-16 150464 8276 ns/op 4815 B/op 50 allocs/op
BenchmarkLargeUnmarshal_gobot-16 145249 8201 ns/op 4816 B/op 50 allocs/op
BenchmarkLargeUnmarshal_gobot-16 146100 8216 ns/op 4816 B/op 50 allocs/op
BenchmarkLargeUnmarshal_telego-16 149001 7802 ns/op 6781 B/op 31 allocs/op
BenchmarkLargeUnmarshal_telego-16 152780 7835 ns/op 6775 B/op 31 allocs/op
BenchmarkLargeUnmarshal_telego-16 156508 7817 ns/op 6780 B/op 31 allocs/op
BenchmarkLargeUnmarshal_telego-16 154938 7816 ns/op 6777 B/op 31 allocs/op
BenchmarkLargeUnmarshal_telego-16 150121 7809 ns/op 6778 B/op 31 allocs/op
BenchmarkLargeUnmarshal_telego-16 152810 7791 ns/op 6780 B/op 31 allocs/op
BenchmarkLargeUnmarshal_telego-16 159613 7784 ns/op 6778 B/op 31 allocs/op
BenchmarkLargeUnmarshal_telego-16 154402 7729 ns/op 6780 B/op 31 allocs/op
BenchmarkLargeUnmarshal_telego-16 157184 7660 ns/op 6782 B/op 31 allocs/op
BenchmarkLargeUnmarshal_telego-16 155822 7768 ns/op 6780 B/op 31 allocs/op
BenchmarkLargeUnmarshal_echotron-16 144252 8147 ns/op 4323 B/op 56 allocs/op
BenchmarkLargeUnmarshal_echotron-16 147961 8089 ns/op 4319 B/op 56 allocs/op
BenchmarkLargeUnmarshal_echotron-16 149847 8049 ns/op 4320 B/op 56 allocs/op
BenchmarkLargeUnmarshal_echotron-16 149128 8069 ns/op 4320 B/op 56 allocs/op
BenchmarkLargeUnmarshal_echotron-16 147277 8075 ns/op 4320 B/op 56 allocs/op
BenchmarkLargeUnmarshal_echotron-16 149132 8089 ns/op 4320 B/op 56 allocs/op
BenchmarkLargeUnmarshal_echotron-16 148837 8014 ns/op 4319 B/op 56 allocs/op
BenchmarkLargeUnmarshal_echotron-16 149288 8050 ns/op 4320 B/op 56 allocs/op
BenchmarkLargeUnmarshal_echotron-16 146833 8097 ns/op 4320 B/op 56 allocs/op
BenchmarkLargeUnmarshal_echotron-16 149233 8041 ns/op 4320 B/op 56 allocs/op
BenchmarkWebhook_ours-16 707102 1721 ns/op 2232 B/op 11 allocs/op
BenchmarkWebhook_ours-16 700047 1734 ns/op 2232 B/op 11 allocs/op
BenchmarkWebhook_ours-16 725071 1721 ns/op 2232 B/op 11 allocs/op
BenchmarkWebhook_ours-16 675003 1751 ns/op 2232 B/op 11 allocs/op
BenchmarkWebhook_ours-16 693903 1787 ns/op 2232 B/op 11 allocs/op
BenchmarkWebhook_ours-16 714036 1751 ns/op 2232 B/op 11 allocs/op
BenchmarkWebhook_ours-16 646494 1816 ns/op 2232 B/op 11 allocs/op
BenchmarkWebhook_ours-16 696355 1801 ns/op 2232 B/op 11 allocs/op
BenchmarkWebhook_ours-16 709545 1734 ns/op 2232 B/op 11 allocs/op
BenchmarkWebhook_ours-16 709700 1725 ns/op 2232 B/op 11 allocs/op
BenchmarkWebhook_gotba-16 611132 2027 ns/op 1496 B/op 17 allocs/op
BenchmarkWebhook_gotba-16 624046 2072 ns/op 1496 B/op 17 allocs/op
BenchmarkWebhook_gotba-16 588478 2093 ns/op 1496 B/op 17 allocs/op
BenchmarkWebhook_gotba-16 609744 2012 ns/op 1496 B/op 17 allocs/op
BenchmarkWebhook_gotba-16 606912 2012 ns/op 1496 B/op 17 allocs/op
BenchmarkWebhook_gotba-16 612211 2000 ns/op 1496 B/op 17 allocs/op
BenchmarkWebhook_gotba-16 605488 2015 ns/op 1496 B/op 17 allocs/op
BenchmarkWebhook_gotba-16 622398 2006 ns/op 1496 B/op 17 allocs/op
BenchmarkWebhook_gotba-16 610478 2017 ns/op 1496 B/op 17 allocs/op
BenchmarkWebhook_gotba-16 610350 2030 ns/op 1496 B/op 17 allocs/op
BenchmarkWebhook_telebot-16 559515 2138 ns/op 1816 B/op 17 allocs/op
BenchmarkWebhook_telebot-16 558510 2057 ns/op 1816 B/op 17 allocs/op
BenchmarkWebhook_telebot-16 587257 2079 ns/op 1816 B/op 17 allocs/op
BenchmarkWebhook_telebot-16 585321 2059 ns/op 1816 B/op 17 allocs/op
BenchmarkWebhook_telebot-16 576236 2067 ns/op 1816 B/op 17 allocs/op
BenchmarkWebhook_telebot-16 570172 2070 ns/op 1816 B/op 17 allocs/op
BenchmarkWebhook_telebot-16 568270 2131 ns/op 1816 B/op 17 allocs/op
BenchmarkWebhook_telebot-16 567567 2094 ns/op 1816 B/op 17 allocs/op
BenchmarkWebhook_telebot-16 586588 2076 ns/op 1816 B/op 17 allocs/op
BenchmarkWebhook_telebot-16 574495 2062 ns/op 1816 B/op 17 allocs/op
BenchmarkWebhook_gobot-16 597710 2006 ns/op 1832 B/op 16 allocs/op
BenchmarkWebhook_gobot-16 594742 2016 ns/op 1832 B/op 16 allocs/op
BenchmarkWebhook_gobot-16 603187 1998 ns/op 1832 B/op 16 allocs/op
BenchmarkWebhook_gobot-16 608301 2011 ns/op 1832 B/op 16 allocs/op
BenchmarkWebhook_gobot-16 605532 1984 ns/op 1832 B/op 16 allocs/op
BenchmarkWebhook_gobot-16 609892 1990 ns/op 1832 B/op 16 allocs/op
BenchmarkWebhook_gobot-16 596637 1999 ns/op 1832 B/op 16 allocs/op
BenchmarkWebhook_gobot-16 592108 1993 ns/op 1832 B/op 16 allocs/op
BenchmarkWebhook_gobot-16 607069 1999 ns/op 1832 B/op 16 allocs/op
BenchmarkWebhook_gobot-16 594915 1997 ns/op 1832 B/op 16 allocs/op
BenchmarkWebhook_telego-16 603300 2021 ns/op 3133 B/op 11 allocs/op
BenchmarkWebhook_telego-16 602503 2016 ns/op 3133 B/op 11 allocs/op
BenchmarkWebhook_telego-16 618267 2016 ns/op 3133 B/op 11 allocs/op
BenchmarkWebhook_telego-16 601855 2027 ns/op 3133 B/op 11 allocs/op
BenchmarkWebhook_telego-16 612424 2035 ns/op 3132 B/op 11 allocs/op
BenchmarkWebhook_telego-16 595890 2074 ns/op 3133 B/op 11 allocs/op
BenchmarkWebhook_telego-16 605565 2001 ns/op 3133 B/op 11 allocs/op
BenchmarkWebhook_telego-16 610453 2096 ns/op 3133 B/op 11 allocs/op
BenchmarkWebhook_telego-16 588056 2069 ns/op 3132 B/op 11 allocs/op
BenchmarkWebhook_telego-16 595764 2025 ns/op 3133 B/op 11 allocs/op
BenchmarkWebhook_echotron-16 599088 1975 ns/op 1720 B/op 16 allocs/op
BenchmarkWebhook_echotron-16 626964 1975 ns/op 1720 B/op 16 allocs/op
BenchmarkWebhook_echotron-16 635306 1967 ns/op 1720 B/op 16 allocs/op
BenchmarkWebhook_echotron-16 606621 1965 ns/op 1720 B/op 16 allocs/op
BenchmarkWebhook_echotron-16 625998 1965 ns/op 1720 B/op 16 allocs/op
BenchmarkWebhook_echotron-16 646352 1976 ns/op 1720 B/op 16 allocs/op
BenchmarkWebhook_echotron-16 634186 1971 ns/op 1720 B/op 16 allocs/op
BenchmarkWebhook_echotron-16 628503 1982 ns/op 1720 B/op 16 allocs/op
BenchmarkWebhook_echotron-16 612586 1975 ns/op 1720 B/op 16 allocs/op
BenchmarkWebhook_echotron-16 622320 1965 ns/op 1720 B/op 16 allocs/op
PASS
ok github.com/lukaszraczylo/go-telegram/test/benchmarks 241.963s
? github.com/lukaszraczylo/go-telegram/test/benchmarks/shared [no test files]