I had the same problem on my 2 year old Nexus 5 a few months ago where once in a while when I would reboot my phone it would give the "optimising app # of #" (often exceeding 140).
It was annoying since it took a good 10 minutes for it to finish, but since it wasn't often so I didn't think much...