Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
refactor(open_graph): drop cheerio and use regex #3680
What does it do?
cheerio is slow and we only use that to parse and list img in post.content. This PR drop cheerio and use regex to do the job.
How to test
git clone -b BRANCH https://github.com/USER/hexo.git cd hexo npm install npm test
Pull request tasks
6491 steps, 9 matches, ~3ms: https://regex101.com/r/N1Rv9w/1
8858 steps, 9 matches, ~5ms: https://regex101.com/r/N1Rv9w/2
6527 steps, 9 matches, ~4ms: https://regex101.com/r/N1Rv9w/3
4313 steps, 9 matched, ~3ms: https://regex101.com/r/N1Rv9w/4
4627 steps, 9 matched, ~4ms: https://regex101.com/r/N1Rv9w/5
Currently in this PR I am using the first one.
After 4f86dde I am now using the forth one.
4573 steps, 9 matched, ~4ms: https://regex101.com/r/N1Rv9w/7
I have update the final benchmark for this PR & #3670
The last benchmark shows this PR increase performance by nearly
I will merge this PR and close #3670 then.