Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hide show vs inserting/deleting html

 
pawan chopra
Ranch Hand
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using backbone js. I have a screen with two pages. I have two options I can render both pages at same time and then hide/show based on selection. Other thing is rendering each page separately. Second approach looks better to me and if I am not wrong. In both cases browser will have to re-paint? Please correct me if I am wrong.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Better" has to be measured against some criteria or objective. What are you measuring against? Browser speed? Memory usage? Clarity of code?
 
pawan chopra
Ranch Hand
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:"Better" has to be measured against some criteria or objective. What are you measuring against? Browser speed? Memory usage? Clarity of code?


I am looking for good performance. So browser speed is what I am measuring against.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, next question then: do you really think there will be a user-discernable difference between the approaches?

What I'm getting at is that if it were my project, I would first strive for code clarity, and then if, and only if, a performance issue arises, start looking at different approaches.

Is there a demonstrable performance problem you are trying to solve?
 
pawan chopra
Ranch Hand
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:OK, next question then: do you really think there will be a user-discernable difference between the approaches?

What I'm getting at is that is it were my project, I would first strive for code clarity, and then if, and only if, a performance issue arises, start looking at different approaches.

Is there a demonstrable performance problem you are trying to solve?


Not really didn't have any issue till now. I am currently rendering instead of show/hide. I feel its clean and simple. Not sure if you agree with me. But other than that am I right that in both ways browser will re-paint?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, "repaint" isn't really a term often used with browsers, but yes, anything that changes the display will cause the browser to, well, change the display.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic