perf($compile): only iterate over elements with link functions

I've been thinking about this a while and @IgorMinar added a TODO for it in 3e0a2e1f.

In a quick test I found this lowered the link time 5-10% for a table row with only ~2/15 cells requiring linking. For DOM trees with a higher percentage of annotated nodes this shouldn't have any noticeable effect. However I think having 50%+ non-annotated nodes is very common (a newline/whitespace text node per element...).
I thought about this more and getting rid of the sparse array is not that easy as it makes code in the later loop more complicated. we should at least prealocate the array as we used to.