Burk Hufnagel wrote:Sounds like you;ve got some experience with using ANTLR. My question is how efficient is the code ANTLR generates versus the code a good developer would create to do the same task?
Burk Hufnagel wrote:As I understand it, creating a performant language is beyond the scope of the book. However, I am curious as to the performance of the kind of languages that the book does help us create as compared to a similar application written in java.
Burk Hufnagel wrote:I'm assuming that a DSL that generates code can't look at the code it's generated and determine that it's substandard in terms of efficiency the way that a human programmer could. If that's the case then one of the trade-offs in using the DSL is that the programmer can get done sooner and perhaps with fewer defects, but the code that is generated/executed is slower because it hasn't been optimized the way that the code in a general purpose language could be.
Terence Parr wrote:Yep, DSLs are trade-offs between runtime efficiency and expressivity. I would say that most problems that cry out for a DSL don't really care about efficiency. Heck, you might be waiting on the network or disk or user much of the time anyway. speed of generated code or execution in an interpreter matter most for general-purpose programming languages I think.