Update about this part. I had thought an algorithm which is O(n log n):

1) clone new and old list of indexes.
1) Loop all new list of indexes, for each one, if it does not exist in the old list of indexes, then create it and remove it from the new list. If it exists in the old list of indexes, remove both from the list.
2) Loop all left old list of indexes, for each one, delete it.

But we can't use it. Because store.indexNames is DOMStringList not string array. They have different API.