C++ performance: checking a block of memory for having specific values in specific cells
I'm doing a research on 2D Bin Packing algorithms. I've asked similar question regarding PHP's performance - it was too slow to pack - and now the code is converted to C++. It's still pretty slow. What my program does is consequently allocating blocks of dynamic memory and populating them with a character 'o' char* bin; bin = new (nothrow) char[area]; if (bin == 0) { cout << "Error: " << area << " bytes could not be allocated"; return false; } for (int i=0; i<area; i++) { bin[i]='o'; } (their size is between 1kb and 30kb for my datasets) Then the program checks different combinations of 'x'