jasondavies / d3-cloud

Create word clouds in JavaScript.
https://www.jasondavies.com/wordcloud/
Other
3.82k stars 1.08k forks source link

Optimize `zeroArray` function #158

Open kravets-levko opened 5 years ago

kravets-levko commented 5 years ago

Hi @jasondavies! I tried to use d3-cloud with a quite large board size (approx. 20000*20000), and noticed that there is a significant lag even when using only few words. The slowest part is zeroArray function. Here are few possible optimizations for it - https://jsperf.com/d3-cloud/ (all of them work fine). Should I submit a fix for it, or you prefer to do it yourself? Thanks!

image image image

Harpush commented 1 year ago

@jasondavies I have this issue too. Sounds like a good addition! I don't mind sending a PR too.