Add Add Python/Oracle version

This commit is contained in:
Peter J. Holzer 2021-05-07 23:09:11 +02:00 committed by Peter J. Holzer
parent 8fd1912537
commit d45287920a
2 changed files with 37 additions and 2 deletions

12
Results
View File

@ -12,12 +12,12 @@ trintignant:~/wrk/database_connect_bench 22:30 :-) 1084% time ./dcb_perl_psql
0.00405609997687861 session 2 0.00405609997687861 session 2
./dcb_perl_psql 0.07s user 0.00s system 90% cpu 0.079 total ./dcb_perl_psql 0.07s user 0.00s system 90% cpu 0.079 total
rorschach:~database_connect_bench 0:12 :-) 1094% time ./dcb_python_mysql --database=simba --user=simba --password=EilaeC2j rorschach:~database_connect_bench 0:12 :-) 1094% time ./dcb_python_mysql --database=simba --user=simba --password=xxxxxxxx
0.045608792919665575 import 0.045608792919665575 import
0.0019447151571512222 connect 0.0019447151571512222 connect
0.04812890104949474 total 0.04812890104949474 total
0.0025201081298291683 session 0.0025201081298291683 session
./dcb_python_mysql --database=simba --user=simba --password=EilaeC2j 0.07s user 0.00s system 98% cpu 0.076 total ./dcb_python_mysql --database=simba --user=simba --password=xxxxxxxx 0.07s user 0.00s system 98% cpu 0.076 total
rorschach:~database_connect_bench 0:13 :-) 1096% time ./dcb_python_psql rorschach:~database_connect_bench 0:13 :-) 1096% time ./dcb_python_psql
0.02288187202066183 import 0.02288187202066183 import
@ -39,3 +39,11 @@ trintignant:~/wrk/database_connect_bench 19:29 :-) 1077% time ./dcb_go_psql
0.0178164 session 0.0178164 session
./dcb_go_psql 0.01s user 0.01s system 52% cpu 0.044 total ./dcb_go_psql 0.01s user 0.01s system 52% cpu 0.044 total
(ora) oraxe:~/wrk/database_connect_bench 23:04 :-) 37% time ./dcb_python_oracle --user hjp --password xxxxxxxxxxxxxxx
[(datetime.datetime(2021, 5, 7, 23, 4, 59, 357630),)]
0.003943046999665967 import
0.04385234999972454 connect
0.04904494299989892 total
0.045101896000232955 session
./dcb_python_oracle --user hjp --password ieFohb5aixi6oic 0.07s user 0.02s system 74% cpu 0.116 total

27
dcb_python_oracle Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env python3
import argparse
import time
ap = argparse.ArgumentParser()
ap.add_argument("--user")
ap.add_argument("--password")
args = ap.parse_args()
t0 = time.monotonic()
import cx_Oracle
t1 = time.monotonic()
db = cx_Oracle.connect(f"{args.user}/{args.password}@localhost/XEPDB1")
t2 = time.monotonic()
csr = db.cursor()
csr.execute("select current_timestamp from dual")
r = csr.fetchall()
print(r)
t3 = time.monotonic()
db.close()
t4 = time.monotonic()
print(t1 - t0, "import")
print(t2 - t1, "connect")
print(t4 - t0, "total")
print(t4 - t1, "session")