Well, you could remove the RegExp. But whether that helps performance is anyone's guess. var d2p = function(s){ var one=[], two=[], a=s.split('-'); one.push(a.shift()); a.forEach(function(part){ one.push('(' + part); two.push(')'); }); return one.join('') + two.join(''); }; If you don't mind having the result fully parenthesised, then you can do this: var d2p = function(s){ return s.split('-').reduceRight(function(whole, part){ return '(' + part + whole + ')'; }, ''); };