Frameworkbenchmarks: actix-core does not use a server-side template for the fortunes test

Created on 5 May 2019  路  7Comments  路  Source: TechEmpower/FrameworkBenchmarks

The current implementation of the fortunes test in actix-core seems not to use a server-side template as mandated by point IX of the requirements - contrast that with the implementation in actix-pg. Instead, actix-core seems to be simply concatenating hardcoded strings.

Pinging @fafhrd91.

Most helpful comment

I apologize for the ambiguity in the requirements and will think about how to clarify them going forward.

The intended interpretation is:

  • The Fortunes requirement to use a templating system takes precedence and should be applied in all cases.
  • For frameworks (or permutations of frameworks) for which no template engine is provided, a suitable template engine should be used as a library supplementing the framework to implement the Fortunes test. For example, some of the Java frameworks do not specify a template engine so their Fortunes implementations use Mustache or similar.

The definition of "template engine" is obviously left undefined and is open to interpretation and debate. But we do want something that is more than string concatenation or an equivalent. I don't want to expressly require that a template should be a file on disk, but the traditional notion of a "template file" merged with a context object to yield output HTML illustrates what we have in mind when we speak of a template engine. We do want implementations of Fortunes to necessarily incur the performance impact of parsing a template and doing that merging to yield an output.

Mustache is cited in the requirements because it is available on many platforms and its small feature set seems a reasonable minimum.

All 7 comments

OK, so the same issue applies to aspcore as well.

Pinging @benaadams.

That particular aspcore implementation is marked as a Platform test

Classification

We classify frameworks as follows:

  • Full-stack, meaning a framework that provides wide feature coverage including server-side templates, database connectivity, form processing, and so on.
  • Micro, meaning a framework that provides request routing and some simple plumbing.
  • Platform, meaning a raw server (not actually a framework at all). Good luck! You're going to need it.

image

I don't think that classifying a framework as a platform means that one can avoid a very clear requirement. Another reading of what you mention is that platform frameworks simply can't be used for the fortunes test, which I don't agree with. In fact, historically there have been implementations based on platforms that still followed all requirements (for the fortunes test), e.g. Lwan in round 13.

Let's see what the TechEmpower team says.

i am fine with using template engine, i dont think it will change much.

ASP.NET Core does have 3 distinct layers, each of which builds on the one before, but each one having a greater "opinion" on how things are done:

  • aspcore does what it has; it does do simple request routing (same code-base is used for all 6 test scenerios), database, XSS and even Json at this level of the stack. Very manual.
    This is the api level and is marked as Platform.
  • aspcore-mw has more complex request routing, more complex plumbing, form-processing, auth, ORMs etc, a lot more is automatically set up for you; some features you have to manually call but they are available to use.
    This is the features level and is marked as Micro.

    • This is also the layer most other alternative .NET stacks plug in e.g. carter and the F# stacks zebra and giraffe and the PHP stack peachpie as it has more features than just HTTP apis (and stuff the rest of the .NET stack itself provides).

  • aspcore-mvc has pages, data-binding, the Razor templating language and lots of other additional web features and everything is setup and resolved for you; so you generally don't have to configure any plumbing.
    This is the "concentrate on your business logic" level and is marked as Full-stack

Could make up a template format to parse and use .NET runtime code-gen; or compile time code-gen to output the exact same code that would perform the same as aspcore uses for Fortunes; however its not part of the provided stack so wouldn't necessarily be a good idiomatic representation of what you'd write for that classification of stack.

I apologize for the ambiguity in the requirements and will think about how to clarify them going forward.

The intended interpretation is:

  • The Fortunes requirement to use a templating system takes precedence and should be applied in all cases.
  • For frameworks (or permutations of frameworks) for which no template engine is provided, a suitable template engine should be used as a library supplementing the framework to implement the Fortunes test. For example, some of the Java frameworks do not specify a template engine so their Fortunes implementations use Mustache or similar.

The definition of "template engine" is obviously left undefined and is open to interpretation and debate. But we do want something that is more than string concatenation or an equivalent. I don't want to expressly require that a template should be a file on disk, but the traditional notion of a "template file" merged with a context object to yield output HTML illustrates what we have in mind when we speak of a template engine. We do want implementations of Fortunes to necessarily incur the performance impact of parsing a template and doing that merging to yield an output.

Mustache is cited in the requirements because it is available on many platforms and its small feature set seems a reasonable minimum.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joanhey picture joanhey  路  5Comments

surfmuggle picture surfmuggle  路  5Comments

mkurz picture mkurz  路  6Comments

joanhey picture joanhey  路  6Comments

msmith-techempower picture msmith-techempower  路  6Comments