Commit 6c8684dc authored by Yuanle Song's avatar Yuanle Song
Browse files

update racket-postgres/ benchmark

use query-rows in select bench
parent a62e91fe
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -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.
+1 −0
Original line number Diff line number Diff line
bench
+1 −1
Original line number Diff line number Diff line
@@ -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))