Created
November 11, 2011 19:46
-
-
Save llibra/1359024 to your computer and use it in GitHub Desktop.
kcdbm performance test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(kc.db:with-db (db "test.kch" :reader :writer :create) | |
(cffi:with-foreign-strings (((kb ks) "Common") ((vb vs) "Lisp")) | |
(let ((ks (1- ks)) (vs (1- vs))) | |
(cffi:defcallback full :pointer | |
((kbuf :pointer) (ksiz kc.ffi.core:size_t) (vbuf :pointer) | |
(vsiz kc.ffi.core:size_t) (sp :pointer) (opq :pointer)) | |
(declare (ignore kbuf ksiz vbuf vsiz opq)) | |
(setf (cffi:mem-aref sp 'kc.ffi.core:size_t) vs) | |
vb) | |
(cffi:defcallback empty :pointer | |
((kbuf :pointer) (ksiz kc.ffi.core:size_t) (sp :pointer) (opq :pointer)) | |
(declare (ignore kbuf ksiz opq)) | |
(setf (cffi:mem-aref sp 'kc.ffi.core:size_t) vs) | |
vb) | |
(let ((full (cffi:callback full)) | |
(empty (cffi:callback empty))) | |
(time (dotimes (n 1000000) (kc.db:accept db kb ks full empty)))) | |
(time (dotimes (n 1000000) (kc.db:set/fs db kb ks vb vs)))))) | |
; Evaluation took: | |
; 2.079 seconds of real time | |
; 1.759030 seconds of total run time (1.737901 user, 0.021129 system) | |
; [ Run times consist of 0.172 seconds GC time, and 1.588 seconds non-GC time. ] | |
; 84.61% CPU | |
; 4,850,449,254 processor cycles | |
; 79,981,472 bytes consed | |
; | |
; Evaluation took: | |
; 0.884 seconds of real time | |
; 0.800843 seconds of total run time (0.798968 user, 0.001875 system) | |
; 90.61% CPU | |
; 2,064,300,490 processor cycles | |
; 0 bytes consed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment