bustabit-script-simulator icon indicating copy to clipboard operation
bustabit-script-simulator copied to clipboard

Laggy on games 100k plus

Open Mtihc opened this issue 6 years ago • 12 comments

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

Mtihc avatar Feb 17 '19 11:02 Mtihc

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.

Mtihc avatar Feb 17 '19 11:02 Mtihc

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

b3n3tt3 avatar Feb 17 '19 19:02 b3n3tt3

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 avatar Feb 18 '19 08:02 Mtihc

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.

Mtihc avatar Apr 08 '19 14:04 Mtihc

@Mtihc

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

Can this be used?

JonathanStables avatar Oct 07 '19 18:10 JonathanStables

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.

izikazem avatar Feb 25 '20 04:02 izikazem

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 [email protected] 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 avatar Feb 25 '20 11:02 Mtihc

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

On Tue, 25 Feb 2020 at 12:03, Mitch Stoffels [email protected] 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 [email protected] 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 avatar Feb 25 '20 11:02 Mtihc

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.

izikazem avatar Feb 26 '20 03:02 izikazem

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.

izhzz avatar May 06 '20 21:05 izhzz

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 [email protected] 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 avatar May 08 '20 11:05 Mtihc

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

Mtihc avatar May 08 '20 11:05 Mtihc