lib/core: Improve performances of last_index_of_from