My second Fan version of Tim Bray's Wide Finder 2 project splits the program into two threads. One thread reads lines, and the other thread does the totalization and reporting. The two threads communicate via Fan's built-in message passing - in this case the messages are the lines being read. This improvement adds 24 lines to the program.
While not suitable for a 8-core machine, it happens to suit my dual core PC (running XP) to keep both cores humming. When run with Server HotSpot 1.6 this program runs on the 100k dataset in 4.5sec. That is the same speed as the original single threaded program. What is really interesting is that when I drop back to Client HotSpot, this multi-threaded version runs faster at 4.0sec versus 5.5sec for the single threaded version - a 27% speed improvement. I have no idea why Client HotSpot exhibits better multi-threading performance than Server HotSpot. Seems pretty weird to me.
brian Wed 4 Jun 2008
My second Fan version of Tim Bray's Wide Finder 2 project splits the program into two threads. One thread reads lines, and the other thread does the totalization and reporting. The two threads communicate via Fan's built-in message passing - in this case the messages are the lines being read. This improvement adds 24 lines to the program.
While not suitable for a 8-core machine, it happens to suit my dual core PC (running XP) to keep both cores humming. When run with Server HotSpot 1.6 this program runs on the 100k dataset in 4.5sec. That is the same speed as the original single threaded program. What is really interesting is that when I drop back to Client HotSpot, this multi-threaded version runs faster at 4.0sec versus 5.5sec for the single threaded version - a 27% speed improvement. I have no idea why Client HotSpot exhibits better multi-threading performance than Server HotSpot. Seems pretty weird to me.