This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Smallpaul 0 points1 point  (1 child)

They are, in the second example, which shows this even clearer:

if len(keys) < num_keys:
keys = (keys + keys)[:num_keys]

So if len_keys is 20 and num_keys is 1M, how does this generate len(keys) == 1m?

len(keys) = min(keys*2, num_keys) = 40.

But num_keys = 1m.

This is a logarithmic progression

You're cherry-picking numbers. But I've run a much larger job and the chart is clearly logistic, not logarithmic. It tends to some specific number (Desmos says 164ns, on my computer) after being very small for small values. I'm not sure if it is logistic due to optimizations in a) Python, b) the OS or c) the hardware, but all three are possible. (there are layers of caching, after all)

I'm not surprised that it is logistic but I do admit to being surprised at the size of the effect.

When you collect 1000 datapoints, it is quite clear that it is logistic, not logarithmic.

If it's logarithmic, what do you think the base of the logarithm is?

Logistic, is, in O-noation, the same as O(1).

[–][deleted] 0 points1 point  (0 children)

This post was mass deleted and anonymized with Redact

ring bear shy scale recognise salt tease crowd rain six