The number of rows does affect computation speed. However, SQL Server have never been strong when working with strings.And as the algorithm is written, it is a multiline scalar function which is even worse for performance in SQL Server.