This appears similar to StackOverflow question 1951192. If you have a real performance need, then try the suggestion there of using FastMM4. You are right that pass-by-reference should blow away pass-by-value for speed on large strings (or large any-kind-of-data).
It could also be worth benchmarking (var data:string) vs. (const data:string) in case the compiler optimizes once better than the other. If they're the same, use const if your function doesn't need to alter the contents of string.
- 101
- 2