[Olena-patches] r3022: [Markov] Speed up the algorithm