The length of input ids is not changing inside the merge() function. Instead of calling len(ids) in every iteration of the while loop, storing it in a variable at the beginning of the loop can help shave of few milliseconds while dealing with large documents.
The length of input ids is not changing inside the
merge()
function. Instead of callinglen(ids)
in every iteration of the while loop, storing it in a variable at the beginning of the loop can help shave of few milliseconds while dealing with large documents.