Fix performance issue for UniqueIdProvider
Old implementation of UniqueIdProvider::GetUniqueId
had O(N*log(N))
time complexity and acquired O(N)
memory space in a stack.
N
here is a number of already created/reserved IDs.
So, old implementation:
- was extremely inefficient
- could raise stack overflow
Plus old implementation had recursive based implementation. And recursive based implementation is forbidden by MISRA.
New implementation is iterative based, has O(N)
time complexity and acquire O(1)
memory space.
Edited by Daniil Nikulin