Skip to content

Extensive garbage collection when using an event with a connection from script #568

Discussion options

You must be logged in to vote

Hi @DoctorGester,

Great! Would a simple sleep(milliseconds) be sufficient?

Yes!

We've looked at this and found that the even the best OS sleep primitives are a bit unpredictable, at least on Windows, so the function we're adding looks like this:

Performance.sleep(delay, precise);

If precise is false or unspecified, sleep uses an OS sleep primitive. If precise is true, it performs a "cooperative spin wait", which provides excellent precision at the cost of mild CPU load (≤3% in our tests).

Additionally, we're adding a way to increase native timer resolution, enhancing the precision of the OS sleep primitive. It's only effective on Windows, but Linux and macOS don't seem to need it anyway.

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@DoctorGester
Comment options

@ClearScriptLib
Comment options

@DoctorGester
Comment options

@ClearScriptLib
Comment options

Answer selected by DoctorGester
@DoctorGester
Comment options

@ClearScriptLib
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants