Skip to content

Conversation

@albanm
Copy link

@albanm albanm commented Aug 31, 2015

This is actually some quite large modification. I am not sure you will be interested, but I think it is worth proposing.

First, I noticed that when running without web workers the page freezes, this is because everything is synchronous and genetic-js never releases the process. Making the fitness async with optional callback passing makes it possible to use at least a setTimeout. The page still lags of course, but it doesn't freeze.

Second, I needed to do some work with the DOM in my fitness function, but I still wanted to use web workers otherwise. So I used messages to simulate running functions in the worker that are actually in the caller context. It works well for me.

@Glavin001
Copy link

For those looking for async support, I've forked this repo and rewrote it in TypeScript and added support for async fitness method (including unit tests): https://github.com/Glavin001/genetic-js
Hope this helps you, too! 😃

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

Successfully merging this pull request may close these issues.

2 participants