Considerations of computation expression optimization
Computation expressions can be further optimized if we carefully implement the design planning. We have discussed the design considerations of a computation workflow in the previous section of this chapter, and we shall carry the considerations as a quick foundation to perform optimization.
The optimization of computation expression is quite hard because of the following factors as consequences of computation expression syntax translations:
Construction of computation expressions depends heavily on syntactic sugar that becomes language constructs. For example,
ReturnFrom
method is translated to a method that returns a result of the underlying type of a computation expression. Therefore, we must follow the strict guidelines of the asynchronous method builders to express translation; otherwise, we will get unpredictable results or even exceptions.Composing the sequence of
let!
requires some wirings of a chainedBind
method builder in the...