Giter Club home page Giter Club logo

Comments (10)

shanethehat avatar shanethehat commented on June 3, 2024

Wow, that's pretty significant. I'll see if can figure something out.

from grafter.

etorreborre avatar etorreborre commented on June 3, 2024

I also tested the @readers annotation on our ApplicationConfig and replaced it with 14 implicit definitions. I observed a further drop of 10 seconds.

from grafter.

shanethehat avatar shanethehat commented on June 3, 2024

My (admittedly simple) test application doesn't seem to have such dramatic differences. Which versions of Scala/SBT are you using?

from grafter.

jcranky avatar jcranky commented on June 3, 2024

Scala 2.11.8 / Sbt 0.13.13

from grafter.

etorreborre avatar etorreborre commented on June 3, 2024

It looks like the @readers annotation makes compilation more performant but having @reader annotation on components degrades the compilation times. The likely explanation is that macro expansion is costly but it is also possible that unnecessary work is done.

The next step would be to compare the AST generated with the @reader macro and with the manual implicit def reader definition.

from grafter.

shanethehat avatar shanethehat commented on June 3, 2024

The AST for the annotated case class in ReaderMacroTest prints as

List(case class C extends scala.Product with scala.Serializable {
  def <init>() = {
    super.<init>();
    ()
  }
}, object C extends scala.AnyRef {
  def <init>() = {
    super.<init>();
    ()
  };
  import org.zalando.grafter.GenericReader._;
  implicit def reader: cats.data.Reader[ApplicationConfig, C] = genericReader
})

from grafter.

etorreborre avatar etorreborre commented on June 3, 2024

No difference really... Maybe the time difference just come from producing the AST from inside the macro, not compiling it afterwards.

from grafter.

shanethehat avatar shanethehat commented on June 3, 2024

The main thing that's different between the two macros is that the Reader macro has to figure out the config class name from the type parameter of the annotation. I'm trying to see if that takes an unusually long time. It does contain a couple of loops, but they were intended to break early.

from grafter.

jcranky avatar jcranky commented on June 3, 2024

@etorreborre If I understood our last discussion in this topic, this is not an issue anymore, right?

from grafter.

etorreborre avatar etorreborre commented on June 3, 2024

Right this can be closed now.

from grafter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.