Saturday, December 10, 2011

Save bits, save power, save the world, Part 2

The GHC Haskell and OCaml compilers do not have builtin popcount support, so again I precomputed the bit pop count for each ASCII letter. Using the same ~9 Mb 4x concatenation of /usr/share/dict/words from last time I measured the performance of the resultant code. This time, the test machine was a Macbook Pro 2.16 GHz with 2 Gb of RAM. The microprocessor is a Core Duo T7400 which has no support for the popcnt instruction anyway.

This is a follow-on post to my experiments with popcount and hash maps in Python, C++, and Ruby in Part 1

Description

Execution Time (ms)

GHC Map Lookup Only/Precomputed

2568

OCaml Map Lookup Only/Precomputed

866

Python Precomputed

5418

g++

843

g++ -O3

505

OCaml is fairly competitive with the unoptimized g++ version. GHC lags quite a bit, but fares alright all things considered. The version of GHC I used was 7.0.4. OCaml was version 3.12.1.

Search

chitika

Disclaimer: I may trade in or out of any of the above names. None of the above should be construed as investment advice. It is only for informational and entertainment purposes. Please consult a qualified financial professional before acting on any financial information.