I translated the code here into C++ as follows
#include <iostream>
using namespace std;
int t = 20;
bool is_evenly_divisible(const int a, const int b) {
    for (int i=2; i<=b; ++i) { // Line 1
        if (a%i != 0)
            return false;
    }
    return true;
}
void run() {
    int i = 10;
    while (!is_evenly_divisible(i, t)) {
        i += 2;
    }
    cout << i << endl;
}
int main(int argc, char** argv) {
    run();
    return 0;
}
With the -O3 flag on compiler g++ 4.8.1 on Mac OSX 10.8.4, I get time 0.568s user time.
Now if I change the counter i in Line 1 in function is_evenly_divisible to size_t, the time suddenly jumps to 1.588s. This persists even if I change all of the variables to size_t, the time increases to 1.646s
What's happening? Shouldn't size_t increase performance rather than decreasing it as it's a more specific type than int?
 
     
     
    