R
R
RA4INA2021-07-05 13:05:51
Python
RA4INA, 2021-07-05 13:05:51

Does the number of id in the variable affect the speed of the bot?

Probably a very stupid question, but there is a variable with the id of users who have access to paid content. Now there are only about 10 id, but if there are 50 or 100 of them, will it affect the speed of the bot?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dooMoob, 2021-07-05
@dooMoob

Depends on the algorithm for working with these IDs. If O depends on n, then yes. If O(1), then no

S
Serg_sel, 2021-07-05
@Serg_sel

It depends on how they are stored and searched by id: for example, if you use a dictionary, then this is a fairly elegant and fast solution:

dictionary = {"id1": {"something": "some_info", "something_other": "some_other_info"}

Thus, as I did now, I can get information from something like this: something = dictionary ["id1"]["something"]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question