You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Concatenating 10k Fragments 10 times is much faster than concatenating 100k fragments one time. This suggests a quadratic (or nonlinear) runtime complexity.
Reproduction in ammonite (Scala 2.13.8):
import$ivy.`org.tpolecat::skunk-core:0.2.3`; importskunk._; importskunk.implicits._defmeasure(code: =>Any) = {valstart=System.nanoTime; code; println(f"${(System.nanoTime - start)/1000000000.0}%.2fs")}
measure { for(i <-0 until 10) Array.fill(10000)(sql"x").foldLeft(sql"")((a,b) =>sql"$a$b") }
// 18s// is much faster than
measure { Array.fill(100000)(sql"x").foldLeft(sql"")((a,b) =>sql"$a$b") }
// 213s
It could be caused by repeated concatenation of a growing List.
The text was updated successfully, but these errors were encountered:
Concatenating 10k Fragments 10 times is much faster than concatenating 100k fragments one time. This suggests a quadratic (or nonlinear) runtime complexity.
Reproduction in ammonite (Scala 2.13.8):
It could be caused by repeated concatenation of a growing
List
.The text was updated successfully, but these errors were encountered: