4 ms·
Why not use serde instead of rolling your own "Savable"? Also you should use Rc/Arc and Weak (along with RefCell/Mutex if needed) instead of the unsafe pointer
by devit 8y ago
Why not use serde instead of rolling your own "Savable"?
Also you should use Rc/Arc and Weak (along with RefCell/Mutex if needed) instead of the unsafe pointers. Even better, if possible, move the functions that access multiple components to the object that holds them all, and don't use any "smart pointers". Another possible design is to pass borrowed references explicitly to the methods, and add them to the trait signatures where needed.
Regarding memory access, it's probably fastest to have an hardcoded fast path for RAM and ROM, and then process the rest like now. Lookup tables might help as well (as long as all the data including them fits in cache, of course).
- FullyFunctional 8y agoThis is very interesting. Do you have a good example to study how this should be done?