Closed Szybet closed 1 year ago
What's the OS?
Arch linux
I don't experience any slowdowns on macOS.
Well, then two questions:
The calls to thread::sleep
happen in parallel threads. The main thread never pauses more than 20 ms (event_pump.wait_event_timeout(20)
and rx.recv_timeout(Duration::from_millis(20))
).
would changing them to lower break something?
Would changing them to lower break something?
I'm not sure I'd want to apply a random hack to solve a problem we don't understand yet.
Could you provide the exact modifications (git diff
) you've made?
here they are
--- a/src/emulator.rs
+++ b/src/emulator.rs
@@ -299,7 +299,7 @@ fn main() -> Result<(), Error> {
'outer: loop {
let mut event_pump = sdl_context.event_pump().unwrap();
- if let Some(sdl_evt) = event_pump.wait_event_timeout(20) {
+ if let Some(sdl_evt) = event_pump.wait_event_timeout(1) {
match sdl_evt {
SdlEvent::Quit { .. } |
SdlEvent::KeyDown { keycode: Some(Keycode::Escape), keymod: Mod::NOMOD, .. } => {
@@ -370,7 +370,7 @@ fn main() -> Result<(), Error> {
}
}
- while let Ok(evt) = rx.recv_timeout(Duration::from_millis(20)) {
+ while let Ok(evt) = rx.recv_timeout(Duration::from_millis(1)) {
match evt {
Event::Open(info) => {
let rotation = context.display.rotation;
@@ -555,7 +555,7 @@ fn main() -> Result<(), Error> {
if enable {
let tx2 = tx.clone();
thread::spawn(move || {
- thread::sleep(Duration::from_secs(2));
+ thread::sleep(Duration::from_secs(1));
tx2.send(Event::Device(DeviceEvent::NetUp)).ok();
});
} else {
It's me again, I have many questions The emulator was really slow for me, just unusable. I checked the code in emulator.rs and changed all lines that concerned something with waiting, like
thread::sleep(Duration::from_secs(2));
to a lower value. Now it works just like on the ereader. Why?...