Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render speed depends on size container #78

Open
yrdem opened this issue Feb 1, 2021 · 1 comment
Open

render speed depends on size container #78

yrdem opened this issue Feb 1, 2021 · 1 comment

Comments

@yrdem
Copy link

yrdem commented Feb 1, 2021

Hi,
Can you help or explain why the render speed depends on the container's size?
With container size 200px 200px the rending takes 4x time more than 400px 600px:

  <div style={{ display: "flex" }}>
      <div style={{ height: 200, width: 200 }}>
        <ReactWordcloud words={words} />
        <ReactWordcloud words={words} />
        <ReactWordcloud words={words} />
        <ReactWordcloud words={words} />
        <ReactWordcloud words={words} />
      </div>
      {/* The slow rendering starts here */}
      <div style={{ height: 400, width: 600 }}>
        <ReactWordcloud words={words} />
        <ReactWordcloud words={words} />
        <ReactWordcloud words={words} />
        <ReactWordcloud words={words} />
        <ReactWordcloud words={words} />        
      </div>
    </div>

Example
https://codesandbox.io/s/react-wordcloud-basic-forked-ie3lg?file=/src/index.js

thanks in advance

@kfritsch
Copy link

kfritsch commented Oct 7, 2021

Since the placement algorithm works randomly it takes more tries to fit words of the same size into a smaller container since there will be more word overlaps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants