Performance
https://scrapbox.io/files/6051b94b58bd2f001c19b328.png
Performance depends on the environment and situations (e.g., Table schema, connection pool, RDMS system). Performance also depends on how the programmer implements it. On this page, we show the results of performance measurement as one example.
Benchmark codes
Table schema
code:sql
CREATE TABLE post (id INT PRIMARY KEY , text VARCHAR(255) , creation_date DATETIME , last_change_date DATETIME , counter1 INT , counter2 DOUBLE)
Operation for benchmark
read
reads one row from table including 10,240 rows using primary key.
insert
inserts one row to table.
read multirow
reads all rows from table including 10,240 rows.
insert multirow
inserts the all given 10,240 rows to table.
/yuunkjm/--.icon
Results of 2.0.7
table:Performance 2.0.7  (microsec/operation) the lower, the better
lib	read	insert	read multirow	insert multirow
Hand coded (baseline)	4.5 	5.1 	3843 	23448 
Sorm4j	3.8 (16% faster)	5.5 (8% slower)	3609 (6% faster)	21521 (8% faster)
Sql2o	7.0 (56% slower)	9.5 (86% slower)	4336 (13% slower)	36309 (55% slower)
JDBI	15.4 (242% slower)	12.2 (139% slower)	5564 (45% slower)	32503 (39% slower)
JOOQ	41.2 (816% slower)	 	21559 (461% slower)	
MyBatis	10.6 (136% slower)	 	9998 (160% slower)	
Spring JdbcTemplate	7.9 (76% slower)	 		
table:lib
nave	ver
sql2o	1.6.0
jdbi	3.42.0
jooq	3.18.7
mybatis	3.5.14
spring-jdbc	6.1.1
commons-dbutils	1.8.1
table:env
item	value
OS	Windows 10 Enterprise 64bit 22H2
CPU	AMD Ryzen 9 3950X 16-Core Processor  3.50 GHz
Memory	64GB (DDR4-3200)
SSD	NVMe Samsung SSD 970
RDBMS	H2 Database 2.2.224
JDBC URL	jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
table:jmh
item	value
JMH version	1.37
VM version	JDK 21, OpenJDK 64-Bit Server VM, 21+35-LTS
VM invoker	EclipseTemurin\jdk-21+35\bin\java.exe
VM options	<none>
Blackhole mode	compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable)
Warmup	1 iterations, 10 s each
Measurement	3 iterations, 10 s each
Timeout	10 min per iteration
Threads	1 thread, will synchronize iterations
Benchmark mode	Average time, time/op
/yuunkjm/--.icon
Results of 1.4.0
table:Performance 1.4.0 (microsec/operation) the lower, the better
lib	read	insert	read multirow	insert multirow
Hand coded (baseline)	4.2 	5.2 	3405 	21135 
Sorm4j	4.3 (2% slower)	5.7 (10% slower)	3091 (-9% slower)	21259 (1% slower)
Sql2o	6.3 (50% slower)	9.3 (79% slower)	3878 (14% slower)	41126 (95% slower)
JDBI	16.5 (293% slower)	12.1 (133% slower)	5128 (51% slower)	37644 (78% slower)
JOOQ	42.9 (921% slower)	 	14123 (315% slower)	
MyBatis	9.6 (129% slower)	 	10083 (196% slower)	
Spring JdbcTemplate	8.7 (107% slower)	 		
table:lib
nave	ver
sql2o	1.6.0
jdbi	3.25.0
jooq	3.15.5
mybatis	3.5.8
spring-jdbc	5.3.14
commons-dbutils	1.7
table:env
item	value
OS	Windows 10 Enterprise 64bit 21H2
CPU	AMD Ryzen 9 3950X 16-Core Processor  3.50 GHz
Memory	64GB (DDR4-3200)
SSD	NVMe Samsung SSD 970
RDBMS	H2 Database 2.0.202
JDBC URL	jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
table:jmh
item	value
JMH version	1.27
VM version	JDK 17.0.1, OpenJDK 64-Bit Server VM, 17.0.1+12
VM invoker	EclipseTemurin\jdk-17.0.1.12-hotspot\bin\java.exe
VM options	<none>
JMH blackhole mode	full blackhole + dont-inline hint; set -Djmh.blackhole.mode=COMPILER to get compiler-assisted onest
Warmup	1 iterations, 10 s each
Measurement	3 iterations, 10 s each
Timeout	10 min per iteration
Threads	1 threads, will synchronize iterations
Benchmark mode	Average time, time/op