diff --git a/README.org b/README.org index e6d354121bb876401e6c0be4abd334fc159bc61b..93bd60fd6128bb1422e1ce1a86ff8d058f760407 100644 --- a/README.org +++ b/README.org @@ -28,12 +28,12 @@ all build is release mode (with -O or equivalent). | pg9.4 | haskell/ghc7.10.3 | postgresql-simple | 0.61 | 26.6 | | pg9.4 | rust/rust1.13.0 | postgres | 0.50 | 26.3 | | pg9.4 | go/go1.7.3 | pq | 0.37 | 27.2 | -| pg9.4 | racket/racket6.5 | built-in db | 2.19 | 26.7 | +| pg9.4 | racket/racket6.5 | built-in db | 1.99 | 26.7 | - Remarks: - python and go's db binding is as fast as C. - rust and haskell is slower. C is 1.65x faster. - - racket is much slower. C is 6x faster. + - racket is much slower. C is 5x faster. ** postgres 9.4, cpython 2.7, psycopg2==2.6.1 http://initd.org/psycopg/docs/usage.html @@ -122,3 +122,23 @@ https://www.postgresql.org/docs/9.4/static/libpq.html So write performance is definitely testing disk IO performance. Read performance is related to the language and runtime. +- try compile it with raco exe first. + 2.00 + 27.84 + -- + 2.02 + 27.62 + + it's about the same. + +- try use query-rows instead of query. + 1.78 + 26.94 + -- + 2.02 + 29.08 + -- + 1.99 + 26.79 + + it's still the slowest. diff --git a/racket-postgres/.gitignore b/racket-postgres/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ba99195bae87cd8efd3684e3fe5bfa459c4bfcbf --- /dev/null +++ b/racket-postgres/.gitignore @@ -0,0 +1 @@ +bench diff --git a/racket-postgres/bench.rkt b/racket-postgres/bench.rkt index 8dd749717e74fabe0f32c0a0bb9c0fb95c5e8afc..404d818d7bc41298ebd2d296f9c8e3f2a59bc3e3 100644 --- a/racket-postgres/bench.rkt +++ b/racket-postgres/bench.rkt @@ -27,7 +27,7 @@ (display (format "~as\n" (/ (- (current-inexact-milliseconds) start) 1000))))) (define (select-test) - (timeit (query pgc "SELECT id, bar FROM foo") TIMES)) + (timeit (query-rows pgc "SELECT id, bar FROM foo") TIMES)) (define (update-test) (timeit (query-exec pgc "UPDATE foo SET bar=bar+1 WHERE id=1") TIMES))