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

Change the way neuron values are cached in NeuralNetwork. #70

Open
HyperCodec opened this issue Jul 4, 2024 · 2 comments · May be fixed by #72
Open

Change the way neuron values are cached in NeuralNetwork. #70

HyperCodec opened this issue Jul 4, 2024 · 2 comments · May be fixed by #72
Assignees
Labels
enhancement New feature or request

Comments

@HyperCodec
Copy link
Owner

HyperCodec commented Jul 4, 2024

By moving the cache to a separate HashMap or something, neurons would not need to be stored in a RwLock, greatly reducing the amount of data being cloned while transferring between topology and mutable. Additionally, flush_state could be merged into predict without fear of performance issues because the map can simply be replaced by a new one in memory, which is way faster than the current iterative approach.

@HyperCodec HyperCodec added the enhancement New feature or request label Jul 4, 2024
@HyperCodec HyperCodec self-assigned this Jul 4, 2024
@HyperCodec
Copy link
Owner Author

Probably also helps #63 because the neuron types could become one.

@HyperCodec
Copy link
Owner Author

HyperCodec commented Jul 4, 2024

The main difficulty I see with this approach is accidentally wasting CPU cycles due to situations where a neuron is in the process of being solved but other threads also try to solve it because there is no RwLock telling it that the work is already being done. Perhaps this could be solved by first creating a temporary locking entry that forces the other ones to wait until it has finished before having free read access to the value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant