How big is $mapping? (And can you show us (some of) what it contains? Eg. the mapping sequence.)
In reply to Re^5: Optimization Help by BrowserUk in thread Optimization Help by jmmitc06