Open
Conversation
- Remove `sleep` from DMStandard. - Two new opcodes Sleep and BackgroundSleep (which is just `sleep -1`, much faster than popping a `float` off for background sleeps). - Create new lightweight async proc state for sleeping. - Compiler/runtime adjustments to handle new opcodes.
…ive-delay sleeps are done in the same thread
There was a problem hiding this comment.
InspectCode found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Collaborator
|
Haven't tested, but goon definitely uses a lot of background/negative/0 sleeps etc if anyone needs a actual codebase testbench |
Contributor
Author
|
Tested with this code: Byond: OD master: OD with PR: |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I wanted to take a shot at continuing the work by @Cyberboss in #1539
After making adjustments to fit the latest codebase, I also made additional changes:
forto accept expressions OR certain statements as its incrementor. (apparently you can havefor(var/i=0, i<1, sleep(0)). neat!)(^ Which breaks in current OD, running as a server)
I based the 10/20 sleep scheduling proc/thread thresholds on this test:
Which produces results like this in Byond:
And with this patch you get:
Which is a bit different around when the c loop ends the 2nd time in a row, but is overall more similar compared to the version on master:
I'm not terribly happy with using hashmaps to lookup the thread/proc info by thread/proc id but maybe it's better than storing the negative sleep counts in the procs and thread classes. As for speed, I wasn't able to reproduce the slow startup as described in the OP of #1262 but the idea is to close that issue. Maybe it helps Goon?