At the moment the Contest._tokens_available method takes O(len(token_timestamps)) time to produce the result. Even if that list is usually quite short (maximum 20 elements in all the competitions I know about), the method is called every time the submission details page is rendered and therefore it may make sense to cache the result, to avoid DoS attacks.