In addition to
substr being faster than a regex, your code is computing:
1/@data
200,000 times. Computing this value only once before looping over the data and storing the result into a variable is very likely to save you some significant time (but benchmarking and/or profiling would be needed to say how much time). Storing the result of a computation to avoid re-computing it many times is called
caching or
memoizing (see for example
https://en.wikipedia.org/wiki/Memoization) and is a very common optimization technique.