Re: [racket-dev] racket/gui performance problem when using lots of items in table-panels
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 19-07-12 16:59, Marijn wrote: > Hi, > > I've been having some performance problems when using lots of items > in table-panels[1]. Switching tabs when running the following > example exhibits the problem. Can anything be done about it? So it seems a missing container-sequence block was causing unnecessary extra problems. With it switching tabs is a lot less painful. However, unfortunately trying to resize the window when showing the second tab is still glacial/unusable. Some clarifications: 1) I'm not claiming the problem is in the table-panel class. I'm just using it as my vehicle to put lots of widgets on the screen. As far as I can judge there is nothing in table-panel that could cause this performance problem. 2) This is a test case reduced from a real program. Therefore the way it goes about recreating widgets cannot be justified without the context of the larger program. It is still not very small, but I did not see a way to make it any smaller without destroying the essential behavior. You can find a reduced test case for just the window resizing problem below. Slightly adapted code: #lang racket/gui ;(require (planet williams/table-panel:1:1/table-panel)) (require "table-panel.rkt") ;;; The top-level frame (define frame (new frame% (label "Table Panel Perf Test") (width 500) (height 500))) (define (current-root-tab) (vector-ref root-tab-vector (send root-tab-panel get-selection)) ) (define (delete-all-children area) #;(for ((child (send area get-children))) (send area delete-child child)) (send area change-children (lambda (children) '())) ) (define (root-tab-callback tab-panel event) (send root-tab-panel change-children (lambda (children) (list (current-root-tab ) (define root-tab-panel (new tab-panel% (choices '()#;tab-names) (parent frame) (callback root-tab-callback))) (define nr-rows 25) (define nr-cols 20) (define on-show-refresh-panel% (class table-panel% (init-field refresher) (super-new) (define/override (on-superwindow-show shown?) (when shown? (displayln "refreshing!") (send this begin-container-sequence) (refresher this) (send this end-container-sequence))) )) (define tab1 (new panel% (parent root-tab-panel))) (define (build-tab2 tab2) (delete-all-children tab2) (for* ((r nr-rows) (c nr-cols)) (new button% (parent tab2) (label (format "~a,~a" r c)) (stretchable-width #t) (stretchable-height #t) (callback (lambda (button event) (printf "~a~n" (send button get-label ) )) (define tab2 (new on-show-refresh-panel% (parent root-tab-panel) (style '(deleted)) (alignment '(center center)) (dimensions `(,nr-rows ,nr-cols)) (refresher build-tab2))) (define tabs `((,tab1 . "Tab 1") (,tab2 . "Tab 2"))) (define tab-names (map cdr tabs)) (define root-tab-vector (list->vector (map car tabs))) (send root-tab-panel set tab-names) (send frame show #t) The window resizing problem is also exhibited by this reduced test case: #lang racket/gui ;(require (planet williams/table-panel:1:1/table-panel)) (require "table-panel.rkt") (define frame (new frame% (label "Window Resize Perf Test") (width 500) (height 500))) (define nr-rows 30) (define nr-cols 25) (define panel (new table-panel% (parent frame) (dimensions `(,nr-rows ,nr-cols)) )) (for* ((r nr-rows) (c nr-cols)) (new button% (parent panel) (label (format "~a,~a" r c)) (stretchable-width #t) (stretchable-height #t) (callback (lambda (button event) (printf "~a~n" (send button get-label ) ) (send frame show #t) Thanks for any help, Marijn [1]:http://planet.racket-lang.org/display.ss?package=table-panel.plt&owner=williams -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlCczOgACgkQp/VmCx0OL2yx/ACgyM2A1eP/vkDvJCCd1PJBDLek xC0AoI56WCkNiZJWY210gFxItVs2tP3l =u64I -END PGP SIGNATURE- _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] racket/gui performance problem when using lots of items in table-panels
Matthew might be able to shed some light on it. But, I suspect you'd have similar performance regardless of the container used. On Fri, Jul 20, 2012 at 1:36 AM, Marijn wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 19-07-12 17:08, Doug Williams wrote: >> I think the problem is the time it takes to create 600 buttons in >> this case, not the time needed to switch between the tabs. I'm not >> sure why you are recreating them each refresh. Am I missing >> something? > > This is a cutdown slightly changed testcase for a performance problem > I'm having in a real program. I'm using some tabs that recreate their > contents in my program, because their contents depend on values input > by the user from another tab. In the testcase, imagine that the first > tab is not blank but lets you specify the number of rows and columns > of the table of buttons on tab 2. > > Marijn > -BEGIN PGP SIGNATURE- > Version: GnuPG v2.0.19 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAlAJCm0ACgkQp/VmCx0OL2y6yQCfYPX0yMMNNSUdk5J3FoCeHYg9 > Ia4AnRbCOVgH13ZyQN/HbrJXkbTC37a4 > =Shso > -END PGP SIGNATURE- _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] racket/gui performance problem when using lots of items in table-panels
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 19-07-12 17:08, Doug Williams wrote: > I think the problem is the time it takes to create 600 buttons in > this case, not the time needed to switch between the tabs. I'm not > sure why you are recreating them each refresh. Am I missing > something? This is a cutdown slightly changed testcase for a performance problem I'm having in a real program. I'm using some tabs that recreate their contents in my program, because their contents depend on values input by the user from another tab. In the testcase, imagine that the first tab is not blank but lets you specify the number of rows and columns of the table of buttons on tab 2. Marijn -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlAJCm0ACgkQp/VmCx0OL2y6yQCfYPX0yMMNNSUdk5J3FoCeHYg9 Ia4AnRbCOVgH13ZyQN/HbrJXkbTC37a4 =Shso -END PGP SIGNATURE- _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] racket/gui performance problem when using lots of items in table-panels
Here is an example of 30 x 20 buttons on a table-panel in a tab panel that doesn't recreate the buttons and it changes between tabs without much delay. #lang racket/gui (require (planet williams/table-panel/table-panel)) (define frame (instantiate frame% ("Test"))) (define tab-panel (instantiate tab-panel% ('("Tab 1" "Tab 2") frame) (callback (lambda (tp e) (case (send tp get-selection) ((0) (send tp change-children (lambda (children) (list tab-1 ((1) (send tp change-children (lambda (children) (list tab-2) (define tab-1 (instantiate panel% (tab-panel) (min-width 400) (min-height 400))) (define tab-2 (instantiate table-panel% (tab-panel) (style '(deleted)) (dimensions '(30 20 (for* ((i (in-range 30)) (j (in-range 20))) (instantiate button% ((format "~a, ~a" i j) tab-2) (stretchable-width #t) (stretchable-height #t) (callback (lambda (b e) (printf "~a~n" (send b get-label)) (send frame show #t) Doug On Thu, Jul 19, 2012 at 9:08 AM, Doug Williams wrote: > I think the problem is the time it takes to create 600 buttons in this > case, not the time needed to switch between the tabs. I'm not sure > why you are recreating them each refresh. Am I missing something? > > Doug > > On Thu, Jul 19, 2012 at 8:59 AM, Marijn wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Hi, >> >> I've been having some performance problems when using lots of items in >> table-panels[1]. Switching tabs when running the following example >> exhibits the problem. Can anything be done about it? >> >> Marijn >> >> >> #lang racket/gui >> >> ;(require (planet williams/table-panel:1:1/table-panel)) >> (require "table-panel.rkt") >> >> ;;; The top-level frame >> (define frame >> (new frame% >>(label "Table Panel Perf Test") >>(width 500) (height 500))) >> >> (define (current-root-tab) >> (vector-ref root-tab-vector (send root-tab-panel get-selection)) ) >> >> (define (delete-all-children area) >> (send area change-children >> (lambda (children) '())) ) >> >> (define (root-tab-callback tab-panel event) >> (send root-tab-panel change-children >> (lambda (children) (list (current-root-tab ) >> >> (define root-tab-panel >> (new tab-panel% >>(choices '()#;tab-names) >>(parent frame) >>(callback root-tab-callback))) >> >> (define nr-rows 30) >> (define nr-cols 20) >> >> (define on-show-refresh-panel% >> (class table-panel% >> (init-field refresher) >> (super-new) >> (define/override (on-superwindow-show shown?) >> (when shown? >> (displayln "refreshing!") >> (refresher))) >> )) >> >> (define tab1 >> (new panel% (parent root-tab-panel))) >> >> (define (build-tab2) >> (delete-all-children tab2) >> (for* ((r nr-rows) >> (c nr-cols)) >> (new button% >> (parent tab2) >> (label (format "~a,~a" r c)) >> (stretchable-width #t) >> (stretchable-height #t) >> (callback >> (lambda (button event) >> (printf "~a~n" >> (send button get-label ) )) >> >> (define tab2 >> (new on-show-refresh-panel% (parent root-tab-panel) >>(style '(deleted)) >>(alignment '(center center)) >>(dimensions `(,nr-cols ,nr-rows)) >>(refresher build-tab2))) >> >> (define tabs >> `((,tab1 . "Tab 1") >> (,tab2 . "Tab 2"))) >> >> (define tab-names (map cdr tabs)) >> (define root-tab-vector (list->vector (map car tabs))) >> >> (send root-tab-panel set tab-names) >> >> (send frame show #t) >> >> >> [1]:http://planet.racket-lang.org/display.ss?package=table-panel.plt&owner=williams >> -BEGIN PGP SIGNATURE- >> Version: GnuPG v2.0.19 (GNU/Linux) >> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ >> >> iEYEARECAAYFAlAIIMoACgkQp/VmCx0OL2x3CgCbBhGkCCroHrEj1giTYA7KYhC4 >> 3sgAoMLUC6S+zouYY4kXm4HFca85odPG >> =n8MG >> -END PGP SIGNATURE- >> _ >> Racket Developers list: >> http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] racket/gui performance problem when using lots of items in table-panels
I think the problem is the time it takes to create 600 buttons in this case, not the time needed to switch between the tabs. I'm not sure why you are recreating them each refresh. Am I missing something? Doug On Thu, Jul 19, 2012 at 8:59 AM, Marijn wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi, > > I've been having some performance problems when using lots of items in > table-panels[1]. Switching tabs when running the following example > exhibits the problem. Can anything be done about it? > > Marijn > > > #lang racket/gui > > ;(require (planet williams/table-panel:1:1/table-panel)) > (require "table-panel.rkt") > > ;;; The top-level frame > (define frame > (new frame% >(label "Table Panel Perf Test") >(width 500) (height 500))) > > (define (current-root-tab) > (vector-ref root-tab-vector (send root-tab-panel get-selection)) ) > > (define (delete-all-children area) > (send area change-children > (lambda (children) '())) ) > > (define (root-tab-callback tab-panel event) > (send root-tab-panel change-children > (lambda (children) (list (current-root-tab ) > > (define root-tab-panel > (new tab-panel% >(choices '()#;tab-names) >(parent frame) >(callback root-tab-callback))) > > (define nr-rows 30) > (define nr-cols 20) > > (define on-show-refresh-panel% > (class table-panel% > (init-field refresher) > (super-new) > (define/override (on-superwindow-show shown?) > (when shown? > (displayln "refreshing!") > (refresher))) > )) > > (define tab1 > (new panel% (parent root-tab-panel))) > > (define (build-tab2) > (delete-all-children tab2) > (for* ((r nr-rows) > (c nr-cols)) > (new button% > (parent tab2) > (label (format "~a,~a" r c)) > (stretchable-width #t) > (stretchable-height #t) > (callback > (lambda (button event) > (printf "~a~n" > (send button get-label ) )) > > (define tab2 > (new on-show-refresh-panel% (parent root-tab-panel) >(style '(deleted)) >(alignment '(center center)) >(dimensions `(,nr-cols ,nr-rows)) >(refresher build-tab2))) > > (define tabs > `((,tab1 . "Tab 1") > (,tab2 . "Tab 2"))) > > (define tab-names (map cdr tabs)) > (define root-tab-vector (list->vector (map car tabs))) > > (send root-tab-panel set tab-names) > > (send frame show #t) > > > [1]:http://planet.racket-lang.org/display.ss?package=table-panel.plt&owner=williams > -BEGIN PGP SIGNATURE- > Version: GnuPG v2.0.19 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAlAIIMoACgkQp/VmCx0OL2x3CgCbBhGkCCroHrEj1giTYA7KYhC4 > 3sgAoMLUC6S+zouYY4kXm4HFca85odPG > =n8MG > -END PGP SIGNATURE- > _ > Racket Developers list: > http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
[racket-dev] racket/gui performance problem when using lots of items in table-panels
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I've been having some performance problems when using lots of items in table-panels[1]. Switching tabs when running the following example exhibits the problem. Can anything be done about it? Marijn #lang racket/gui ;(require (planet williams/table-panel:1:1/table-panel)) (require "table-panel.rkt") ;;; The top-level frame (define frame (new frame% (label "Table Panel Perf Test") (width 500) (height 500))) (define (current-root-tab) (vector-ref root-tab-vector (send root-tab-panel get-selection)) ) (define (delete-all-children area) (send area change-children (lambda (children) '())) ) (define (root-tab-callback tab-panel event) (send root-tab-panel change-children (lambda (children) (list (current-root-tab ) (define root-tab-panel (new tab-panel% (choices '()#;tab-names) (parent frame) (callback root-tab-callback))) (define nr-rows 30) (define nr-cols 20) (define on-show-refresh-panel% (class table-panel% (init-field refresher) (super-new) (define/override (on-superwindow-show shown?) (when shown? (displayln "refreshing!") (refresher))) )) (define tab1 (new panel% (parent root-tab-panel))) (define (build-tab2) (delete-all-children tab2) (for* ((r nr-rows) (c nr-cols)) (new button% (parent tab2) (label (format "~a,~a" r c)) (stretchable-width #t) (stretchable-height #t) (callback (lambda (button event) (printf "~a~n" (send button get-label ) )) (define tab2 (new on-show-refresh-panel% (parent root-tab-panel) (style '(deleted)) (alignment '(center center)) (dimensions `(,nr-cols ,nr-rows)) (refresher build-tab2))) (define tabs `((,tab1 . "Tab 1") (,tab2 . "Tab 2"))) (define tab-names (map cdr tabs)) (define root-tab-vector (list->vector (map car tabs))) (send root-tab-panel set tab-names) (send frame show #t) [1]:http://planet.racket-lang.org/display.ss?package=table-panel.plt&owner=williams -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlAIIMoACgkQp/VmCx0OL2x3CgCbBhGkCCroHrEj1giTYA7KYhC4 3sgAoMLUC6S+zouYY4kXm4HFca85odPG =n8MG -END PGP SIGNATURE- _ Racket Developers list: http://lists.racket-lang.org/dev