myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bart.Kum...@Koopmanint.com
Subject [Trinidad] Preventing unnecessary calls to DataModel?
Date Thu, 21 Feb 2008 14:38:08 GMT
Hi List,

I implemented my own DataModel for backing a tr:table. By adding logging 
to my DataModel, I discovered that the table seems to call the DataModel 
more often than necessary. Depending on how "smart" the DataModel is, this 
can have a bad influence on the performance. Is there a way to prevent 
those calls muyself? Or should I consider this as a bug? To prove my 
point, I have a snippet of my log file pasted below.

I created these log entries as follows:
- I have a data set with 95542 records.
- I've set the rows parameter of tr:table to 15 (so 15 rows per page)

It looks like the table is implemented with some sort of "triple check 
everything" philosophy. For instance the getRowCount() is called three 
times. I think it should be enough to call it once. But what really 
surprises me, is that a combination of setRowIndex and getRowIndex is 
called for every last row of a page. That is, every last row of a page 
that appears in the drop down box. For pages that are hidden behind the 
"More..." option of the drop down, the methods are not called. And why is 
the rowIndex reset to 2 every time? When the first page is actually being 
filled with rows, the getRowCount is called once again. And for each row 
on a page, a isRowAvailable is called twice, and a getRowIndex even seven 
times! I know that neither of those are expensive calls. Fortunately the 
most expensive call (getRowData) is only called once per row. But I still 
get the impression that it can be implemented somewhat more efficient. Why 
is it neccesary to verify that a row exists before adding it to the drop 
down list? By calling getRowCount() the table should know that all rows 
between 0 and (in this case) 95541 does exist, isn't it?

ScrollableDataModel created
ScrollableDataModel.setRowIndex(-1) called.
ScrollableDataModel.isRowAvailable() called on row 0. Returning true
ScrollableDataModel.getRowIndex() called on row 1
ScrollableDataModel.getRowIndex() called on row 1
ScrollableDataModel.isRowAvailable() called on row 1. Returning true
ScrollableDataModel.getRowIndex() called on row 1
ScrollableDataModel.setRowIndex(-1) called.
ScrollableDataModel.isRowAvailable() called on row 0. Returning true
ScrollableDataModel.getRowData() called on row 1
ScrollableDataModel.isRowAvailable() called on row 1. Returning true
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.getRowCount() returning 95542
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(14) called.
ScrollableDataModel.isRowAvailable() called on row 14. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowCount() returning 95542
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.getRowCount() returning 95542
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(0) called.
ScrollableDataModel.isRowAvailable() called on row 0. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(14) called.
ScrollableDataModel.isRowAvailable() called on row 14. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(29) called.
ScrollableDataModel.isRowAvailable() called on row 29. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(44) called.
ScrollableDataModel.isRowAvailable() called on row 44. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(59) called.
ScrollableDataModel.isRowAvailable() called on row 59. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(74) called.
ScrollableDataModel.isRowAvailable() called on row 74. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(89) called.
ScrollableDataModel.isRowAvailable() called on row 89. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(104) called.
ScrollableDataModel.isRowAvailable() called on row 104. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(119) called.
ScrollableDataModel.isRowAvailable() called on row 119. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(134) called.
ScrollableDataModel.isRowAvailable() called on row 134. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(149) called.
ScrollableDataModel.isRowAvailable() called on row 149. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(164) called.
ScrollableDataModel.isRowAvailable() called on row 164. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(179) called.
ScrollableDataModel.isRowAvailable() called on row 179. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(194) called.
ScrollableDataModel.isRowAvailable() called on row 194. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(209) called.
ScrollableDataModel.isRowAvailable() called on row 209. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(224) called.
ScrollableDataModel.isRowAvailable() called on row 224. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(239) called.
ScrollableDataModel.isRowAvailable() called on row 239. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(254) called.
ScrollableDataModel.isRowAvailable() called on row 254. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(269) called.
ScrollableDataModel.isRowAvailable() called on row 269. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(284) called.
ScrollableDataModel.isRowAvailable() called on row 284. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(299) called.
ScrollableDataModel.isRowAvailable() called on row 299. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(314) called.
ScrollableDataModel.isRowAvailable() called on row 314. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(329) called.
ScrollableDataModel.isRowAvailable() called on row 329. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(344) called.
ScrollableDataModel.isRowAvailable() called on row 344. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(359) called.
ScrollableDataModel.isRowAvailable() called on row 359. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(374) called.
ScrollableDataModel.isRowAvailable() called on row 374. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(389) called.
ScrollableDataModel.isRowAvailable() called on row 389. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(404) called.
ScrollableDataModel.isRowAvailable() called on row 404. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(419) called.
ScrollableDataModel.isRowAvailable() called on row 419. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(434) called.
ScrollableDataModel.isRowAvailable() called on row 434. Returning true
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.isRowAvailable() called on row 2. Returning true
ScrollableDataModel.getRowData() called on row 3
ScrollableDataModel.isRowAvailable() called on row 3. Returning true
ScrollableDataModel.getRowIndex() called on row 4
ScrollableDataModel.getRowCount() returning 95542
ScrollableDataModel.getRowIndex() called on row 4
ScrollableDataModel.setRowIndex(14) called.
ScrollableDataModel.isRowAvailable() called on row 14. Returning true
ScrollableDataModel.setRowIndex(4) called.
ScrollableDataModel.setRowIndex(0) called.
ScrollableDataModel.isRowAvailable() called on row 0. Returning true
ScrollableDataModel.getRowData() called on row 1
ScrollableDataModel.isRowAvailable() called on row 1. Returning true
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.getRowIndex() called on row 2
ScrollableDataModel.setRowIndex(1) called.
ScrollableDataModel.isRowAvailable() called on row 1. Returning true
ScrollableDataModel.getRowData() called on row 2
ScrollableDataModel.isRowAvailable() called on row 2. Returning true
ScrollableDataModel.getRowIndex() called on row 3
ScrollableDataModel.getRowIndex() called on row 3
ScrollableDataModel.getRowIndex() called on row 3
ScrollableDataModel.getRowIndex() called on row 3
ScrollableDataModel.getRowIndex() called on row 3
ScrollableDataModel.getRowIndex() called on row 3
ScrollableDataModel.getRowIndex() called on row 3
ScrollableDataModel.setRowIndex(2) called.
ScrollableDataModel.isRowAvailable() called on row 2. Returning true
ScrollableDataModel.getRowData() called on row 3
ScrollableDataModel.isRowAvailable() called on row 3. Returning true
ScrollableDataModel.getRowIndex() called on row 4
ScrollableDataModel.getRowIndex() called on row 4
ScrollableDataModel.getRowIndex() called on row 4
ScrollableDataModel.getRowIndex() called on row 4
ScrollableDataModel.getRowIndex() called on row 4
ScrollableDataModel.getRowIndex() called on row 4
ScrollableDataModel.getRowIndex() called on row 4
ScrollableDataModel.setRowIndex(3) called.
ScrollableDataModel.isRowAvailable() called on row 3. Returning true
ScrollableDataModel.getRowData() called on row 4
ScrollableDataModel.isRowAvailable() called on row 4. Returning true
ScrollableDataModel.getRowIndex() called on row 5
ScrollableDataModel.getRowIndex() called on row 5
ScrollableDataModel.getRowIndex() called on row 5
ScrollableDataModel.getRowIndex() called on row 5
ScrollableDataModel.getRowIndex() called on row 5
ScrollableDataModel.getRowIndex() called on row 5
ScrollableDataModel.getRowIndex() called on row 5
ScrollableDataModel.setRowIndex(4) called.
ScrollableDataModel.isRowAvailable() called on row 4. Returning true
ScrollableDataModel.getRowData() called on row 5
ScrollableDataModel.isRowAvailable() called on row 5. Returning true
ScrollableDataModel.getRowIndex() called on row 6
ScrollableDataModel.getRowIndex() called on row 6
ScrollableDataModel.getRowIndex() called on row 6
ScrollableDataModel.getRowIndex() called on row 6
ScrollableDataModel.getRowIndex() called on row 6
ScrollableDataModel.getRowIndex() called on row 6
ScrollableDataModel.getRowIndex() called on row 6
ScrollableDataModel.setRowIndex(5) called.
ScrollableDataModel.isRowAvailable() called on row 5. Returning true
ScrollableDataModel.getRowData() called on row 6
ScrollableDataModel.isRowAvailable() called on row 6. Returning true
ScrollableDataModel.getRowIndex() called on row 7
ScrollableDataModel.getRowIndex() called on row 7
ScrollableDataModel.getRowIndex() called on row 7
ScrollableDataModel.getRowIndex() called on row 7
ScrollableDataModel.getRowIndex() called on row 7
ScrollableDataModel.getRowIndex() called on row 7
ScrollableDataModel.getRowIndex() called on row 7
ScrollableDataModel.setRowIndex(6) called.
ScrollableDataModel.isRowAvailable() called on row 6. Returning true
ScrollableDataModel.getRowData() called on row 7
ScrollableDataModel.isRowAvailable() called on row 7. Returning true
ScrollableDataModel.getRowIndex() called on row 8
ScrollableDataModel.getRowIndex() called on row 8
ScrollableDataModel.getRowIndex() called on row 8
ScrollableDataModel.getRowIndex() called on row 8
ScrollableDataModel.getRowIndex() called on row 8
ScrollableDataModel.getRowIndex() called on row 8
ScrollableDataModel.getRowIndex() called on row 8
ScrollableDataModel.setRowIndex(7) called.
ScrollableDataModel.isRowAvailable() called on row 7. Returning true
ScrollableDataModel.getRowData() called on row 8
ScrollableDataModel.isRowAvailable() called on row 8. Returning true
ScrollableDataModel.getRowIndex() called on row 9
ScrollableDataModel.getRowIndex() called on row 9
ScrollableDataModel.getRowIndex() called on row 9
ScrollableDataModel.getRowIndex() called on row 9
ScrollableDataModel.getRowIndex() called on row 9
ScrollableDataModel.getRowIndex() called on row 9
ScrollableDataModel.getRowIndex() called on row 9
ScrollableDataModel.setRowIndex(8) called.
ScrollableDataModel.isRowAvailable() called on row 8. Returning true
ScrollableDataModel.getRowData() called on row 9
ScrollableDataModel.isRowAvailable() called on row 9. Returning true
ScrollableDataModel.getRowIndex() called on row 10
ScrollableDataModel.getRowIndex() called on row 10
ScrollableDataModel.getRowIndex() called on row 10
ScrollableDataModel.getRowIndex() called on row 10
ScrollableDataModel.getRowIndex() called on row 10
ScrollableDataModel.getRowIndex() called on row 10
ScrollableDataModel.getRowIndex() called on row 10
ScrollableDataModel.setRowIndex(9) called.
ScrollableDataModel.isRowAvailable() called on row 9. Returning true
ScrollableDataModel.getRowData() called on row 10
ScrollableDataModel.isRowAvailable() called on row 10. Returning true
ScrollableDataModel.getRowIndex() called on row 11
ScrollableDataModel.getRowIndex() called on row 11
ScrollableDataModel.getRowIndex() called on row 11
ScrollableDataModel.getRowIndex() called on row 11
ScrollableDataModel.getRowIndex() called on row 11
ScrollableDataModel.getRowIndex() called on row 11
ScrollableDataModel.getRowIndex() called on row 11
ScrollableDataModel.setRowIndex(10) called.
ScrollableDataModel.isRowAvailable() called on row 10. Returning true
ScrollableDataModel.getRowData() called on row 11
ScrollableDataModel.isRowAvailable() called on row 11. Returning true
ScrollableDataModel.getRowIndex() called on row 12
ScrollableDataModel.getRowIndex() called on row 12
ScrollableDataModel.getRowIndex() called on row 12
ScrollableDataModel.getRowIndex() called on row 12
ScrollableDataModel.getRowIndex() called on row 12
ScrollableDataModel.getRowIndex() called on row 12
ScrollableDataModel.getRowIndex() called on row 12
ScrollableDataModel.setRowIndex(11) called.
ScrollableDataModel.isRowAvailable() called on row 11. Returning true
ScrollableDataModel.getRowData() called on row 12
ScrollableDataModel.isRowAvailable() called on row 12. Returning true
ScrollableDataModel.getRowIndex() called on row 13
ScrollableDataModel.getRowIndex() called on row 13
ScrollableDataModel.getRowIndex() called on row 13
ScrollableDataModel.getRowIndex() called on row 13
ScrollableDataModel.getRowIndex() called on row 13
ScrollableDataModel.getRowIndex() called on row 13
ScrollableDataModel.getRowIndex() called on row 13
ScrollableDataModel.setRowIndex(12) called.
ScrollableDataModel.isRowAvailable() called on row 12. Returning true
ScrollableDataModel.getRowData() called on row 13
ScrollableDataModel.isRowAvailable() called on row 13. Returning true
ScrollableDataModel.getRowIndex() called on row 14
ScrollableDataModel.getRowIndex() called on row 14
ScrollableDataModel.getRowIndex() called on row 14
ScrollableDataModel.getRowIndex() called on row 14
ScrollableDataModel.getRowIndex() called on row 14
ScrollableDataModel.getRowIndex() called on row 14
ScrollableDataModel.getRowIndex() called on row 14
ScrollableDataModel.setRowIndex(13) called.
ScrollableDataModel.isRowAvailable() called on row 13. Returning true
ScrollableDataModel.getRowData() called on row 14
ScrollableDataModel.isRowAvailable() called on row 14. Returning true
ScrollableDataModel.getRowIndex() called on row 15
ScrollableDataModel.getRowIndex() called on row 15
ScrollableDataModel.getRowIndex() called on row 15
ScrollableDataModel.getRowIndex() called on row 15
ScrollableDataModel.getRowIndex() called on row 15
ScrollableDataModel.getRowIndex() called on row 15
ScrollableDataModel.getRowIndex() called on row 15
ScrollableDataModel.setRowIndex(14) called.
ScrollableDataModel.isRowAvailable() called on row 14. Returning true
ScrollableDataModel.getRowData() called on row 15
ScrollableDataModel.isRowAvailable() called on row 15. Returning true
ScrollableDataModel.getRowIndex() called on row 16
ScrollableDataModel.getRowIndex() called on row 16
ScrollableDataModel.getRowIndex() called on row 16
ScrollableDataModel.getRowIndex() called on row 16
ScrollableDataModel.getRowIndex() called on row 16
ScrollableDataModel.getRowIndex() called on row 16
ScrollableDataModel.getRowIndex() called on row 16
ScrollableDataModel.setRowIndex(4) called.
ScrollableDataModel.isRowAvailable() called on row 4. Returning true
ScrollableDataModel.getRowData() called on row 5
ScrollableDataModel.isRowAvailable() called on row 5. Returning true
ScrollableDataModel.getRowIndex() called on row 6
ScrollableDataModel.setRowIndex(1) called.
ScrollableDataModel.isRowAvailable() called on row 1. Returning true
ScrollableDataModel.getRowData() called on row 2
ScrollableDataModel.isRowAvailable() called on row 2. Returning true
ScrollableDataModel.getRowIndex() called on row 3
ScrollableDataModel.setRowIndex(6) called.
ScrollableDataModel.isRowAvailable() called on row 6. Returning true
ScrollableDataModel.getRowData() called on row 7
ScrollableDataModel.isRowAvailable() called on row 7. Returning true
ScrollableDataModel.getRowIndex() called on row 8

Best regards,
Bart Kummel

Mime
View raw message