Here something you can try if I've understood well:
# a model with a famous dataset
model <- glm(formula= vs ~ wt + disp, data=mtcars, family=binomial)
# let's predict the same data: use type response to have probability as result
pred <- predict(model, mtcars, type="response")
library(caret)
# here you decide the cutoff
pred_<- as.factor(ifelse(pred>0.77,'1','0'))
# here we go!
confusionMatrix(pred_, as.factor(mtcars$vs))
Confusion Matrix and Statistics
Reference
Prediction 0 1
0 18 3
1 0 11
Accuracy : 0.9062
95% CI : (0.7498, 0.9802)
No Information Rate : 0.5625
P-Value [Acc > NIR] : 2.684e-05
Kappa : 0.8049
Mcnemar's Test P-Value : 0.2482
Sensitivity : 1.0000
Specificity : 0.7857
Pos Pred Value : 0.8571
Neg Pred Value : 1.0000
Prevalence : 0.5625
Detection Rate : 0.5625
Detection Prevalence : 0.6562
Balanced Accuracy : 0.8929
'Positive' Class : 0
Just out of curiosity I've taken a look at what happens under the hood, and I've used [dtruss/strace][1] on each test.
C++
./a.out < in
Saw 6512403 lines in 8 seconds. Crunch speed: 814050
syscalls `sudo dtruss -c ./a.out < in`
CALL COUNT
__mac_syscall 1
<snip>
open 6
pread 8
mprotect 17
mmap 22
stat64 30
read_nocancel 25958
Python
./a.py < in
Read 6512402 lines in 1 seconds. LPS: 6512402
syscalls `sudo dtruss -c ./a.py < in`
CALL COUNT
__mac_syscall 1
<snip>
open 5
pread 8
mprotect 17
mmap 21
stat64 29
[1]: http://en.wikipedia.org/wiki/Strace