| Ticket UUID: | 960391 | |||
| Title: | Improved binding for listboxes in extended selection mode | |||
| Type: | Patch | Version: | None | |
| Submitter: | eriklns | Created on: | 2004-05-25 20:43:04 | |
| Subsystem: | 09. [listbox] | Assigned To: | fvogel | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2016-02-22 15:02:01 | |
| Resolution: | Out of Date | Closed By: | fvogel | |
| Closed on: | 2016-02-22 15:02:01 | |||
| Description: |
Improved binding for listboxes in extended selection mode ========================================================= A typical usage of a listbox in extended selection mode is the extending of the selection by pressing the <Shift> button in combination with hitting the <Up> an <Down> arrow keys or pressing the <B1> mouse button. The listbox behaviour for these actions is defined in the proc tk::ListBoxMotion, which can be found in the file listbox.tcl in the Tk library. Especially for this specific behaviour, the revised proc tk::ListBoxMotion below exhibits considerable improvements in execution speed and display handling. The revised proc has also been submitted as a patch to sourceforge. I post it here to c.l.t for those among the newsgroup readers who want to try it in an early stage. Sincerely, Erik Leunissen -------------- Summary of improvements ======================= a. Changing the selection on various incontiguous selected/deselected ranges with <Shift-B1>: Reduction of execution time in the order of 25 - 33% (1.33 - 1.5 times faster) b. Changing (extending/reducing) the selection by a single item through <Shift-Up>, <Shift-Down> or dragging the mouse one item with <Shift-B1> pressed: Reduction of execution time in the order of 50 - 70% (2 - 3.5 times faster) c. As in b. but for the special case that the action doesn't change the selection state of the item under the pointer: Reduction of execution time in the order of 99 - 99.3% (100 - 150 times faster) With respect to cases b and c: Using the standard Tk bindings for listboxes in combination with hardware (CPU and video card) that is nothing special, an item immediately adjacent to the item that to be (de)selected could be seen to flicker for a moment. With the revised code, the flicker is gone. Erik Leunissen =========== | |||
| User Comments: |
fvogel added on 2016-02-22 15:02:01:
Thanks for this extensive clarification and review. I concur with your conclusions: let's just abandon this. I close the ticket now. erikleunissen added on 2016-02-22 14:27:02: I've revisited this patch. The clue of this patch was to minimize hardware access, i.e. to collect as many display changes in a single screen access; since screen access was the expensive part of the whole process. Like you François, right now, I can't detect the display flicker anymore. (Which I remember to have observed very clearly in 2004). Since the time that I submitted the patch, no changes at the script level have been made that could explain a dramatic performance gain of the listbox code. I don't know about the C-side. The most obvious difference since 2004 is hardware improvement. When I composed this patch I didn't even have an LCD display, just a CRT monitor. I can imagine that this makes a big difference in access times. I don't now about graphics cards / GPU's, which I also expect to have improved substantially. Maybe this is the reason that we don't observe any display flicker anymore. Regarding the speed improvement: your measurement seems as good as any to me. The fact that no speed improvement can be observed anymore may be explained as follows: - the performance gain through hardware access and - the performance loss by the extra amount of code instructions that this patch involves are now balanced. Given all of this, the minimization of hardware access is of little practical consequence. If it doesn't matter where the time is spent (in code or hardware access) then I don't see a point in pursuing this issue ... ... unless CRT devices are still very relevant somewhere What do you think? Greetings, Erik Leunissen. fvogel added on 2016-01-20 21:29:53: Thank you for the pathes. There is obviously a lot of work behind them.
I have rebased the patches to the latest trunk and have committed them in branch bug-960391ffff. I took both patches in that commit (ListboxBeginSelect and ListboxMotion).
Unfortunately, I fail to see performance improvements with the patch.
What I did to measure performance:
package require Tk
destroy .l
listbox .l -selectmode extended
for {set i 0} {$i < 200} {incr i} {
.l insert end "Item $i"
}
pack .l
Then select "Item 0" (mouse button-1) and drag the mouse down till the last item. Measure time with your wristwatch.
Result: 10 +/-0.5 seconds with or without the patch. I do not detect any performance improvement.
Since you submitted your work perhaps the listbox performance was increased in such a way that the improvement is no longer discernible?
Or I may very well test the wrong way. Could you perhaps explain in details how you tested this, and how you measured the performance improve? The patches do not include any such evaluation tools.
Also, regarding flicker on the display I cannot trigger any such effect, even without the patch on ListboxBeginSelect.
Can you still help...? I know, it's been 10 years since you provided this work...
eriklns added on 2004-05-27 03:16:56: File Added - 88548: ListBoxMotion.tcl eriklns added on 2004-05-27 03:15:46: File Deleted - 88411: eriklns added on 2004-05-27 00:15:30: File Added - 88522: ListboxBeginSelect.tcl Logged In: YES user_id=113903 There is one more location in listbox.tcl where the display handling can be improved. The suplied revision for tk::ListboxBeginSelect prevents that the selected item flickers on the display. File attached file ListboxBeginSelect.tcl holds this revision. Erik Leunissen =========== eriklns added on 2004-05-26 03:47:42: File Added - 88411: ListBoxMotion.tcl | |||
Attachments:
- ListBoxMotion.tcl [download] added by eriklns on 2004-05-27 03:16:56. [details]
- ListboxBeginSelect.tcl [download] added by eriklns on 2004-05-27 00:15:30. [details]
