hibernate跟jdbc的查询速度相差10???

03-08-27 neuhawk
我按照robbin的程序测试。

查询1000条纪录:(hibernate使用list)

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 311ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 1362ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 461ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 70ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 631ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 70ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 80ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 441ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 270ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 70ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 461ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 50ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 70ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 591ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 60ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 60ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 591ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 60ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 80ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 441ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 50ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 210ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 461ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 80ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 60ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 591ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 50ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 70ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 441ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 60ms

//////////////还有ms的驱动也不是很差阿。

而如果查询100条纪录,在cat.hbm.xml增加jcs-cache usage="read-only"

而hibarenate改成

Iterator iter = q.iterate();(是不是这样用jcs??)

测试结果

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 80ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 862ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 230ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 20ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 641ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 20ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 40ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 701ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 20ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 0ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 681ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 20ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 0ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 561ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 60ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 0ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 541ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 0ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 0ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 681ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 0ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 10ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 571ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 10ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 0ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 561ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 0ms

Start Reading Records with JSQL JDBC...

Finished Reading Records with JSQL JDBC: 10ms

Start Reading Records with Hibernate...

Finished Reading Records with Hibernate: 551ms

Start Reading Records with MS JDBC...

Finished Reading Records with MS JDBC: 0ms

/////////////////为什么呢?hibernate我用的是jsql的驱动。

1
yehs220
2003-08-28 10:44

neuhawk
2003-08-28 11:07
to ;yehs220

我就是根据那个贴子来做个阿,可是测试结果跟他们的相差很远。

猜你喜欢