I compared 7 functions, which solely purpose was to figure out the indices of every uppercase letter.
I used timeit
and plot the results using pyplot.
I wrote 6 testcases:
TEST_CASES = (
"Hello World!",
"".join(random.choice(string.ascii_letters) for _ in range(50)),
"".join(random.choice(string.ascii_letters) for _ in range(100)),
"".join(random.choice(string.ascii_letters) for _ in range(200)),