A simple GPX "sanitizer": it tries to sort <trkpt/>s elements from <trakseg/> by proximity.
I wanted to draw a kind of art poster from the OpenStreetMap contributed GPS traces. But these ones can be "anonymized", i.e. the points of the track segments are supposed to be shuffled.
I first worked on a ruby implementation, but it was way too long to execute (~5 minutes on my computer to reorder 4702 points), then I reimplemented it in C.
It became a kind of benchmark between good ol' compiled languages and fancy-trendy interpreted ones. Conclusion ? If you're able to write C without taking too much time or having headaches, you should definitely consider using C.
