link-preview-generator
link-preview-generator copied to clipboard
Improve speed & keep "lockfileVersion": 2
@AndrejGajdos https://github.com/AndrejGajdos/link-preview-generator/pull/24#issuecomment-1058411135 I removed packge-lock.json and kept index.js.
and
Testing & Result
testURL | https://www.google.co.kr/ | avg | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Improvement | 3.375 | 3.464 | 3.869 | 3.575 | 3.838 | 3.593 | 3.928 | 4.102 | 3.611 | 3.356 | 3.6711 |
Original | 3.717 | 3.328 | 4.024 | 4.997 | 3.697 | 3.567 | 3.743 | 3.271 | 3.535 | 4.182 | 3.8061 |
abort script | 2.928 | 2.811 | 2.784 | 2.922 | 2.910 | 3.783 | 3.132 | 4.621 | 3.253 | 3.141 | 3.2285 |
testURL | https://www.youtube.com/ | avg | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Improvement | 4.199 | 4.784 | 4.664 | 4.088 | 3.945 | 4.118 | 4.177 | 4.206 | 4.658 | 4.037 | 4.2876 |
Original | 4.130 | 4.965 | 4.295 | 5.154 | 4.950 | 5.177 | 4.101 | 4.769 | 4.344 | 4.217 | 4.6102 |
abort script | 2.923 | 2.534 | 2.528 | 2.594 | 2.745 | 2.475 | 2.824 | 2.414 | 2.861 | 2.599 | 2.6497 |
testURL | https://www.facebook.com/ | avg | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Improvement | 3.188 | 2.866 | 2.959 | 2.911 | 3.082 | 2.913 | 2.944 | 2.897 | 3.041 | 3.038 | 2.9839 |
Original | 3.005 | 3.005 | 3.083 | 3.094 | 3.047 | 3.161 | 3.050 | 2.932 | 3.069 | 3.045 | 3.0491 |
abort script | 2.651 | 2.686 | 2.959 | 2.892 | 2.748 | 2.958 | 2.847 | 3.013 | 2.807 | 2.892 | 2.8453 |
testURL | https://www.apple.com/kr/ | avg | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Improvement | 2.567 | 2.585 | 2.580 | 2.350 | 2.459 | 2.310 | 2.330 | 2.682 | 2.510 | 3.004 | 2.5377 |
Original | 2.504 | 3.091 | 2.981 | 3.073 | 3.316 | 2.601 | 3.262 | 3.815 | 2.799 | 2.858 | 3.03 |
abort script | 1.808 | 1.641 | 1.730 | 1.973 | 1.843 | 1.806 | 1.711 | 1.778 | 2.019 | 1.838 | 1.8147 |
Additional considerations
What I have been thinking about for a long time is 'Can I abort script?' As you can see, a significant performance improvement occurs in test cases with script abort. However, if metadata is not sufficient and it is a single page application (SPA), I think script is required.
Please check this PR and give me feedback.