cos-archives / hgrid

[UNMAINTAINED] A Javascript-based hierarchical grid that can be used to manage and organize file/folder-like data
Apache License 2.0
23 stars 14 forks source link

Performance improvement. #85

Closed kavitshah8 closed 10 years ago

kavitshah8 commented 10 years ago

This code uses only one assignment statement.

sloria commented 10 years ago

I'm not seeing why this would lead to a performance improvement; Tree.data was only ever assigned once. Care to explain?

kavitshah8 commented 10 years ago

Sorry for not giving detailed explanation. Currently, Tree.data is assigned twice. Once on L41 and on L52. My patch uses it only once. And hopefully it will not break anything else. Did I answer your question ?

sloria commented 10 years ago

Due to the if-else logic, those two lines will not execute together.

kavitshah8 commented 10 years ago

Make sense. I failed to realize that. Basically, I was working on Technical Exercise which is a part of interview process. I have to propose something for it. I liked hgrid project so I was reading its source code and thought that might be a good place to use java scripts || operator. I am also reading test.js in the project as I have some background in unit testing. Most likely I will propose something in testing which might be appropriate.

sloria commented 10 years ago

No problem. Best of luck!