Mtihc / bustabit-script-simulator

Simulate running a script on bustabit
21 stars 10 forks source link

Laggy on games 100k plus #1

Open Mtihc opened 5 years ago

Mtihc commented 5 years ago

The page becomes laggy when you simulate 100k+ games. Needs a performance fix.

Mtihc commented 5 years ago

Javscript does not support multithreading.

The obvious solution is to use WebWorkers. But since this project was bootstrapped with create-react-app, this is not so easy. I'll have to do npm run eject or use react-app-rewired or something, in order to configure worker-loader.

b3n3tt3 commented 5 years ago

i have a idea

pre calculate the 1.4mil games (using provably fair) and store the busts somewhere. Each hash's busts is readily available for anyone. Saves time if done this way instead of calculating from hash on every session

Mtihc commented 5 years ago

Calculating the busts is not really the heavy part. Simulating the games one by one is the heavy part!

I've fixed this using javascript's setImmediate. Now the browser won't freeze anymore.

Mtihc commented 5 years ago

Reopening this issue because it's still laggy at 100k+ simulated games.

Hoping this pull-request is merged soon: https://github.com/facebook/create-react-app/pull/5886 so that I can use WebWorkers to solve this issue.

JonathanStables commented 5 years ago

@Mtihc

https://kentcdodds.com/blog/speed-up-your-app-with-web-workers

Can this be used?

izikazem commented 4 years ago

Why not get a hash list with python and then send it to javascript? In python we can get 1 million numbers in seconds and js should just run the simulation.

Mtihc commented 4 years ago

You’re right, but...

This project is frontend only. If I want to have some socket messaging between python and javascript I would need a backend and I can no longer host it on github.io

Thats one argument against your suggestion.

On Tue, 25 Feb 2020 at 05:53, izi notifications@github.com wrote:

Why not get a hash list with python and then send it to javascript? In python we can get 1 million numbers in seconds and js should just run the simulation.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Mtihc/bustabit-script-simulator/issues/1?email_source=notifications&email_token=AAKLXWEMC3MISSPQC4BXW3LRESP4BA5CNFSM4GX6BEOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM2RU7Y#issuecomment-590682751, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKLXWB7KB7P6KIYQN6PZ3TRESP4BANCNFSM4GX6BEOA .

Mtihc commented 4 years ago

Send me some cash and I might be able to afford a server ;)

On Tue, 25 Feb 2020 at 12:03, Mitch Stoffels mitchstoffels@gmail.com wrote:

You’re right, but...

This project is frontend only. If I want to have some socket messaging between python and javascript I would need a backend and I can no longer host it on github.io

Thats one argument against your suggestion.

On Tue, 25 Feb 2020 at 05:53, izi notifications@github.com wrote:

Why not get a hash list with python and then send it to javascript? In python we can get 1 million numbers in seconds and js should just run the simulation.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Mtihc/bustabit-script-simulator/issues/1?email_source=notifications&email_token=AAKLXWEMC3MISSPQC4BXW3LRESP4BA5CNFSM4GX6BEOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM2RU7Y#issuecomment-590682751, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKLXWB7KB7P6KIYQN6PZ3TRESP4BANCNFSM4GX6BEOA .

izikazem commented 4 years ago

That is right, how about to add an option that allow to use a json file with for example, a list exported with python by the user. That's like if the user execute the "backend". I can develop the python's code as support.

izhzz commented 4 years ago

I can develop the python's code as support.

All we need is a pre-made file with all the hashes for millions of games. We can just verifiy the pre-made file much quicker than collecting it by ourselves every time we need it, correct?

If you can supply a solutions like that, that would be great. Would sponsor your some coffees.

Mtihc commented 4 years ago

Seems like we’re going in circles.

Generating the hashes and the busts is not the heavy part. Actually simulation the games with your custom script is the heavy part! So a pre-made list of hashes will not solve the problem.

izikazem suggested simulating the games in python. And then I could make a feature to import the results and render the chart. But that seems dumb. You could just as easy use excel or something to render a chart.

On Wed, 6 May 2020 at 23:11, izhzz notifications@github.com wrote:

I can develop the python's code as support.

All we need is a pre-made file with all the hashes for millions of games. We can just verifiy the pre-made file much quicker than collecting it by ourselves every time we need it, correct?

If you can supply a solutions like that, that would be great. Would sponsor your some coffees.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Mtihc/bustabit-script-simulator/issues/1#issuecomment-624893470, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKLXWFD6LZLWDYURFITVSLRQHHBDANCNFSM4GX6BEOA .

Mtihc commented 4 years ago

In my opinion the only real solution is what I said here: https://github.com/Mtihc/bustabit-script-simulator/issues/1#issuecomment-480859644