Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Refactor WriteAttribute API surface. #177

Closed
pranavkm opened this issue Oct 3, 2014 · 2 comments
Closed

Refactor WriteAttribute API surface. #177

pranavkm opened this issue Oct 3, 2014 · 2 comments

Comments

@pranavkm
Copy link
Contributor

pranavkm commented Oct 3, 2014

Today we generate a single WriteAttribute method which contains values that are only used for instrumentation. The suggestion here is to instead have two methods

  • WriteAttribute which does not carry any instrumentation information. I'll update this method's signature once I investigate.
  • WriteInstrumentedAttribute which carries instrumentation information. This method will look identical to the current WriteAttribute.

The primary motive for this method is to have minimal runtime effects when instrumentation (BrowserLink) is not enabled.

@yishaigalatzer
Copy link
Contributor

@pranavkm if we already addressed this issue, please close. Otherwise move to RC

@danroth27 danroth27 modified the milestones: 4.0.0, 4.0.0-beta3 Mar 19, 2015
@danroth27 danroth27 modified the milestones: 4.0.0-beta5, 4.0.0-beta6 May 18, 2015
@Eilon Eilon modified the milestones: 4.0.0-beta6, 4.0.0-beta7 Jun 29, 2015
@Eilon Eilon modified the milestones: 4.0.0-beta7, 4.0.0-beta8 Aug 7, 2015
@pranavkm pranavkm modified the milestones: 4.0.0-rc1, 4.0.0-beta8 Sep 29, 2015
pranavkm added a commit that referenced this issue Sep 30, 2015
@pranavkm
Copy link
Contributor Author

We decided an alternative would be to replace the structures with multiple individual calls

For instance:

Before

WriteAttribute("class", 
  Tuple.Create(" class=\"", 74), 
  Tuple.Create("\"", 86), 
  Tuple.Create(Tuple.Create("", 82), 
  Tuple.Create<System.Object, System.Int32>(cls, 82), 
  false));

After

BeginWriteAttribute("class", " class=\"", 74, "\"", 86, 1);
WriteAttributeValue("", 82, cls, 82, 4, false);
EndWriteAttribute();

Since attributes cannot be interleaved, tracking state in Mvc is simple. This avoids having different code paths for instrumented and non-instrumented hosts without the overhead of allocating structures.

@pranavkm pranavkm changed the title Create different generated codes for WriteAttribute depending on EnableInstrumentation Refactor WriteAttribute API surface. Sep 30, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants