Skip to content

Major performance improvements#11

Merged
petschekr merged 4 commits intomasterfrom
performance
Apr 11, 2017
Merged

Major performance improvements#11
petschekr merged 4 commits intomasterfrom
performance

Conversation

@petschekr
Copy link
Copy Markdown
Member

  • Moves some Cheerio-based hacky rendering to Handlebar templates
  • Simplifies loading of states and implements returning to the same state based on the URL hash
  • Greatly improves performance when searching through large lists of attendees by preallocating list elements from the template when the page is first loaded and reusing them instead of deleting and regenerating all of them on each new search.
    • Testing on a list of 500 attendees yielded an improvement of ~15x in the best case.

Closes #8

New approach preallocates nodes on page load for better performance than deleting and recreating from the template whenever the list is updated.
Copy link
Copy Markdown
Member

@illegalprime illegalprime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, a few nit picky things I think you should change.

Comment thread package.json Outdated
"@types/express": "^4.0.34",
"@types/handlebars": "^4.0.32",
"@types/mocha": "^2.2.38",
"@types/moment": "^2.13.0",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed:

npm WARN deprecated @types/[email protected]: This is a stub types definition for Moment (https://github.com/moment/moment). Moment provides its own type definitions, so you don't need @types/moment installed!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread package.json
},
"dependencies": {
"body-parser": "^1.17.1",
"cheerio": "^0.22.0",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cheerio is still required in some places:

$ git grep cheerio
test/api.ts:import * as cheerio from "cheerio";
test/api.ts:                            let $ = cheerio.load(response.text);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this!

Comment thread package.json
"devDependencies": {
"@types/body-parser": "0.0.33",
"@types/chai": "^3.4.34",
"@types/cheerio": "^0.17.31",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If cheerio is still needed, this is obviously still needed, just a reminder comment.

@petschekr
Copy link
Copy Markdown
Member Author

@illegalprime Thanks for letting me know about those. I amended the changes in fb68378

@petschekr petschekr merged commit 1e58030 into master Apr 11, 2017
@petschekr petschekr deleted the performance branch April 13, 2017 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants