outr / perfolation

Performance focused interpolation



Build Status Gitter Maven Central Latest version

Performance focused interpolation

Based on the original work of Dmitry Komanov (https://medium.com/@dkomanov/scala-string-interpolation-performance-21dc85e83afd).

Note: the current version of the interpolation Macro is a complete rip-off of fast-string-interpolator as their performance is superior, but they don't currently support Scala.js or Scala Native.

What is it?

As shown in the article by Dmitry Komanov, Scala's s"" and f"" interpolation are incredibly slow. This is an effort make String interpolation as fast as it should be with the additional features of type-safe formatting with code-completion.

Main Features

String interpolation


s"Interpolation of $string"


p"Interpolation of $string"

Type-safe alternatives to String format


f"Time: $timeInMillis%tT, Date: $timeInMillis%tD"


p"Time: ${timeInMillis.t.T}, Date: ${timeInMillis.t.D}"

Getting Started

Support for Scala (2.11, 2.12), Scala.js (2.11, 2.12), and ScalaNative (2.11)

SBT Dependencies:

libraryDependencies += "com.outr" %%% "perfolation" % "1.0.2"


Simply import perfolation._ and start using:

import perfolation._

val greeting = "Hello, World!"
val time = System.currentTimeMillis()

println(p"$greeting @ ${time.t.T}")