String interpolation vs concatenation

Viewed 7499

Is string interpolation more performant than concatenation to build a string in scala? For example:

val myVal = "def"
val test = s"abs${myVal}ghi"

vs

val test = "abc" + myVal + "ghi"

I am asking because I need to write the toString method for a class which has a lot of parameters and the interpolated string therefore gets really long and confusing and I would like to break it up into multiple lines but fear that it will perform badly if I concatenate.

1 Answers
Related