ba0f3 / telebot.nim

Async Telegram Bot API Client implement in @Nim-Lang
MIT License
165 stars 24 forks source link

Message response can be very sluggish #65

Closed WeebNetsu closed 2 years ago

WeebNetsu commented 2 years ago

Hello :)

So I've started moving my bot from Python to Nim, and for the most part there are no problems with the move, although, the response time often takes half a second more (or more) to send a reply, compared to the Python version... The Python version uses pyTelegramBotAPI

Now this is of course nothing massive, but that speed difference can sometimes be quite noticeable... Is this a Nim thing? Or maybe I'm compiling it wrong? Or is there something in the module slowing it down?

WeebNetsu commented 2 years ago

It seems to be fast at times and other times slow, I can't seem to pinpoint what causes the change in reply speed

ba0f3 commented 2 years ago

I will do a benchmark to check it out.

Can you use treeform's hottie to figure out which is the time consumer?

WeebNetsu commented 2 years ago

Thanks :)

Yeah, I'll give it a shot :)

WeebNetsu commented 2 years ago

So I'm a total noob with hottie, should I be sending you the dump.txt?

ba0f3 commented 2 years ago

If you dont mind

WeebNetsu commented 2 years ago

dump.txt

Also, here is my code, in case you think I may have done something wrong https://github.com/WeebNetsu/steves-teacher-telegram-bot

ba0f3 commented 2 years ago

I figured out that post method of asynchttpclient tooks about 1s to send a message. Maybe that's why response is slow. I'm trying to resolve it.

hamidb80 commented 2 years ago

Yesterday I ran my bot on a server. Everything was super fast, from sending messages to processing them.

It was even faster than my nodejs bot.

I honestly didn't expect that. Maybe the issue is no longer valid

ba0f3 commented 2 years ago

Glad to hear that! @WeebNetsu can you please check it again?

WeebNetsu commented 2 years ago

Yes, I'm a bit busy this weekend, but I should be doing a lot of testing next weekend again, and will be able to check again ;)

ba0f3 commented 2 years ago

Please reopen if needed