Closed ZjMNZHgG5jMXw closed 7 years ago
Hmmmm. I would think that I'd have to start by benchmarking - String.replicate, and printfn are potentially both pretty slow, even aside from Chiron! Being honest, Chiron is probably not the highest performing JSON lib - it's more focused on power and flexibility. That said, it's always worth looking, so if we can get something representative benchmarked I'll take a look!
I suspected something else in the chain as well, for instance, printfn
, but it showed that
String.replicate 30000 "a" |> printfn "%s"
was much faster.
Hmnmm, we'll definitely need to get some numbers and profiling set up to see where potential hotspots are. I'm fairly snowed under for the next week or two, but will hopefully be able to give it some attention after that.
I'd guess that it is the escaping. Any data of similar quantities go through the Json.serialize |> Json.format
chain much quicker.
I've been pinged by this issue now as well. I will be taking a swing at a PR today. The hot spot is definitely in the escaping function.
Yes, I can certainly imagine. I've not had the bandwidth to look at that function, but I can certainly imagine a less functional, but more efficient mutating approach! A PR will be happily received 😄
I'm trying to render long strings as json. A (minimal) example would is
String.replicate 30000 "a" |> Json.serialize |> Json.format |> printfn "%s"
The F# program (or script) with Chiron is taking much more time to render than comparable programs in, e.g., Go.Is there anything that I could change, like maybe a more efficient string implementation, to improve the situation?
Thanks!