Sequence and the code performance
Sequences are, without doubt, extremely powerful members of the functional programmer tool belt. However, they are not free of gotchas that may hurt the performance badly. It is best that they are known and avoided. A few of them are as follows:
Unfortunate materialization, which may be either unnecessary/premature elements materialization or the other way around, missing elements materialization.
Data laziness, in concert with the non-preserving once current element values, can severely hurt the performance in a situation where the algorithm requires multiple traversals or where calculating elements is expensive. The developer should be able to compensate for these detrimental factors by applying patterns such as caching and/or memoization.
Often, when composing data processing pipelines, the developer may carelessly use a library function that unexpectedly requires them to enumerate the entire sequence. This is not necessarily a bad thing, but it should be...