From 9f00817df7983ac6317301a2ea724c303b252d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Raddum=20Berg?= Date: Sun, 17 Dec 2023 19:23:45 +0100 Subject: [PATCH] touchup --- .../blog/2023-12-17-the-cost-of-implicits.mdx | 21 ++++++++++++---- .../src/components/ScalaCompileTimesChart.jsx | 24 +++++++------------ 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/site/blog/2023-12-17-the-cost-of-implicits.mdx b/site/blog/2023-12-17-the-cost-of-implicits.mdx index b7161a04cb..c89da4116d 100644 --- a/site/blog/2023-12-17-the-cost-of-implicits.mdx +++ b/site/blog/2023-12-17-the-cost-of-implicits.mdx @@ -28,7 +28,7 @@ for having a codebase full of implicits which need to be resolved. Read on to se Typo is a code-generation library for working with PostgreSQL in Scala. You can read more in the [introduction](https://oyvindberg.github.io/typo/docs/). -It was built to replace huge swatches of boilerplate in applications, +It was built to replace huge swathes of boilerplate in applications, as well as to provide sorely needed type-safety to avoid having to test everything. A crucial design goal was to fit into your system such as it is. @@ -73,6 +73,15 @@ import EmailaddressRowUnsaved from '!!raw-loader!@site/blog/emailaddress/Emailad
EmailaddressRow.scala
EmailaddressRowUnsaved.scala
+In total it's about this much: +``` +-------------------------------------------------------------------------------- + Language Files Lines Blank Comment Code +-------------------------------------------------------------------------------- + Scala 1052 47011 3215 7436 36360 +-------------------------------------------------------------------------------- +``` + ## Initial comparison of compile times Each benchmark is run three times, and in the graphs you can choose to se minimum or average compile times. @@ -227,9 +236,13 @@ anorm,scala213,true,7622,7593 anorm,scala3,true,7050,6948 `} -This brings the compile time for doobie down to about the same as for anorm and zio-jdbc. +### Observations + +- This brings the compile time for doobie down to about the same as for anorm and zio-jdbc! +- We lose a handsome amount of compile time for zio-jdbc and anorm. But it's less clear that it's enough to be worth inlining manually. +It's a great conclusion actually, resolving implicits is fast as long as it's a straightforward process. -Great! So what is going on? +### Great! So what is going on with doobie then? I honestly haven't dug into all the details, but I have a guess which looks obvious. In order to interpolate values into an SQL query, doobie needs to resolve a chain of implicits instead of just one. @@ -310,7 +323,7 @@ I excluded them for the text above since there was nothing interesting to say ab You can see how "inline implicits" mode also speeds up compilation of these JSON codecs. ### Benchmark limitations -I think part of this improvement from "inlined implicits" is due to the fact that the compiler is a bit warmer the second time around. +I think part of this improvement from "inlined implicits" is due to the fact that the compiler is a bit warmer since it will just have finished compiling without inlined implicits. Note specifically that we get faster compiles for "baseline" with "inlined implicits" mode, although the generated code is the same. diff --git a/site/src/components/ScalaCompileTimesChart.jsx b/site/src/components/ScalaCompileTimesChart.jsx index 77b622b51a..3ee69815ed 100644 --- a/site/src/components/ScalaCompileTimesChart.jsx +++ b/site/src/components/ScalaCompileTimesChart.jsx @@ -78,23 +78,17 @@ const ScalaCompileTimesChart = ({id, children: csvData}) => { : 'Minimum Compile Times (Seconds)', }, scales: { - xAxes: [ - { - stacked: true, - ticks: { - autoSkip: false, - }, + y: { + stacked: false, + ticks: { + beginAtZero: true, + // callback: value => value + 's', }, - ], - yAxes: [ - { - stacked: false, - ticks: { - beginAtZero: true, - callback: value => value + 's', - }, + title: { + display: true, + text: 'Milliseconds', }, - ], + }, }, }, });