Long-time MODX Core team member Garry Nutting came up with this gem, and even posted it on his blog here. I ran a bunch of tests, and Garry's method is at least 40x faster than the next fastest method I could devise, for generating XML sitemaps.
When you're talking thousands of resources, this can be the difference between a time-out and a snappy response.
I've added a couple bits to Garry's Snippet, in order to support multiple Contexts. Here's the gist: