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

Optimize for singlethreaded #37

Open
5 tasks
nic-hartley opened this issue Mar 9, 2023 · 0 comments
Open
5 tasks

Optimize for singlethreaded #37

nic-hartley opened this issue Mar 9, 2023 · 0 comments
Labels
k: feature small increment to existing bits p: tuig tuig crate s: runner agent runners

Comments

@nic-hartley
Copy link
Owner

There's a lot of boilerplate/defensive programming that's only needed for multithreading and can be disabled at compile time for slightly better performance (and compatibility!) in singlethreaded code, e.g.:

  • Using Arc<Mutex<Option<T>>> in Bundle (could be Cell<Option<T>> for singlethreaded!)
  • DashMap in Machine is only necessary if multiple threads are touching it at once
  • The various IoRunners all use multithreading primitives for synchronizing with their IoSystems
  • Requiring Send + Sync of Agents, Messages, etc.

All of that can be yeeted! And it should be. Especially leading up to wasm compatibility, which will probably always be easiest to build on no_std.

  • Figure out a good way to signal single-threadedness
    • Opt-out feature enabled by any sys/run/plat which expects multithreading?
    • More general no_std feature/antifeature?
  • Identify solid replacements for all the uses of multithreading we currently have
  • Write some form of abstraction layer which easily toggles (would this make a good separate crate?)
  • Use that abstraction layer everywhere
  • Some sort of automated check to ensure multithreading things are only used when they should be and vice versa
@nic-hartley nic-hartley added p: tuig tuig crate s: runner agent runners k: feature small increment to existing bits good first issue issues which are good for first-time contributors and removed good first issue issues which are good for first-time contributors labels Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k: feature small increment to existing bits p: tuig tuig crate s: runner agent runners
Projects
None yet
Development

No branches or pull requests

1 participant