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

[idea] CAS for reference counts #42

Open
dimaqq opened this issue Jun 11, 2017 · 0 comments
Open

[idea] CAS for reference counts #42

dimaqq opened this issue Jun 11, 2017 · 0 comments

Comments

@dimaqq
Copy link

dimaqq commented Jun 11, 2017

"hotspot bias locks" text presents an explanation why CAS is typically fast (doesn't require bus activity if this CPU has the value in a cache line in M state).

Perhaps CAS would prove faster than atomic inc/dec for cases without contention?

The fib test case may be particularly nasty here (at least 4 refcount ops on fib for 34 bytecode instructions and references on the stack), and I wonder just how well it represents real-world programs?

On one hand, multithreaded CPU-bound programs are very likely to execute exact same code in most threads;

On the other, useful programs have notably more code, and the ratio of shared (fib) to private references (locals, ephemeral objects) is going to be much lower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant