Comments (10)
Wow, that's pretty significant. I'll see if can figure something out.
from grafter.
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.
My (admittedly simple) test application doesn't seem to have such dramatic differences. Which versions of Scala/SBT are you using?
from grafter.
Scala 2.11.8 / Sbt 0.13.13
from grafter.
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.
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.
No difference really... Maybe the time difference just come from producing the AST from inside the macro, not compiling it afterwards.
from grafter.
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.
@etorreborre If I understood our last discussion in this topic, this is not an issue anymore, right?
from grafter.
Right this can be closed now.
from grafter.
Related Issues (20)
- Add instances matchers HOT 1
- Filter nodes to display but respect transitive dependencies HOT 1
- Report the success of `replace` HOT 6
- Change `Rewriter.start` with `Rewriter.replaceAll`
- Support typed components with type bounds HOT 4
- Configuration with type parameters HOT 1
- Use sbt 1.x
- Compilation fail using a case class with no parameters HOT 7
- bug in Quick Start docs at https://zalando.github.io/grafter HOT 3
- scala.js support? HOT 2
- readers annotation generating reader for self HOT 4
- Use the pairs and fromOneStep functions from Kiama 2.1.0-RC2 HOT 1
- Bump to the most recent version on installation page
- Use Kiama 2.1.0 HOT 1
- Update version in installation.md HOT 1
- Provide a more idiomatic way to create reader instances in libraries HOT 1
- Visualize components attributes HOT 1
- Use only the scala AST instead of quasiquotes to implement macro-annotations HOT 1
- Migrate to the new scala macros HOT 3
- Can we mention grafter in cats' README? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grafter.