1. A method comprising: receiving at a memory module an instruction from a host to perform a POPCOUNT operation on a bit vector stored in the memory module; and executing the POPCOUNT operation within the memory module, without transferring the bit vector to the host for the execution, wherein executing the POPCOUNT operation includes: dividing bits in the bit vector into a plurality of non-overlapping segments, calculating a segment-specific bitcount for each of the plurality of non-overlapping segments, and adding all segment-specific bitcounts to generate a result.