fast-string-interpolator
fast-string-interpolator copied to clipboard
Project Merging?
Sorry guys, if I had noticed this project existed I might not have created this one: https://github.com/outr/perfolation
Would you be interested in combining efforts? We both seem to have the same core focus but have each branched off to add unique functionality. Perhaps together we could create one powerful project?
Great work, Matt!
You have managed to release a string interpolator which can be a replacement in most cases for all 3 standard interpolators of Scala, and made it available for Scala.js & Scala Native platforms!
I have checked that it works quite competitive in terms of throughput and heap usage. Please see updated results of benchmarks: https://sizmek.github.io/fast-string-interpolator/
Ideally, bests of our work should end up in the Scala language repository, and I see that some improvements for string interpolation are coming in 2.12.5: https://github.com/scala/scala/pull/6093
You are right that now we have different focusing. While our main goal is to get 100% compatible drop-in replacement for standard string interpolators with exceptional performance, the 2nd goal is to test Scala macros technology for emitting of low-level implementations (usually we call it boilerplate code) which will help reach safety and mechanical sympathy (when software and hardware working together in harmony). First steps of research in that direction were done in jsoniter-scala project, and here I would reuse some findings for serialization to strings.
Personally, I would happy to contribute to your project, but let see what think our organization owners and contributors.
@plokhotnyuk thanks. I'm up for any changes in perfolation. It looks like you all are getting better performance, but there are a few extra features perfolation provides. I'm not stuck on the name, but I think "fast-string-interpolator" is a bit long and generic. I was looking for a name that I could extract a single character to be used for interpolation ("p" in this case).
String interpolation is defined without reference to the standard lib StringContext:
scala> object StringContext { class X { def s(args: Any*) = "hi" } ; def apply(ps: String*) = new X }
defined object StringContext
scala> s"asdf"
res1: String = hi
Instead of extension methods with funky names, you can just supply a custom StringContext for importing with the well-known names.
@som-snytt Different names are used to not override standard string interpolators and allow mixed usage of them with that are proposed in this library
👍 I see.
Not sure how happy you guys will be, but I completely ripped off your Macro for Perfolation in the current branch. The primary functionality that Perfolation provides that FSI doesn't, is Scala.js and Scala Native builds in addition to additional type-safe numeric and date formatting functionality. I still want to discuss merging projects as I don't especially care about the interpolation, but it makes sense to couple with the type-safe formatting functionality.