If the number of markers is above some set limit, I'd:

- sort the markers by line number; this will make it clearer to the user that we've stopped displaying markers, instead of random ones in the file disappearing
- use a sublist() call to limit to the first x; this means that the following for loop won't have to

In any case, the important part is to sort first :)