Skip to content

Conversation

@nickysn
Copy link
Contributor

@nickysn nickysn commented Sep 18, 2025

No description provided.

return;
}

let thread_id: u64 = rb_eval_string(c"Thread.current".as_ptr() as *const c_char)
Copy link
Member

@alehander92 alehander92 Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed in discord chat: writing again one question here, sorry for repeating: isn't this slow: to evaluate it as ruby code : it seems we can access the thread_id in other places from *const rb_internal_thread_event_data_t, probably here we can't access something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thread ID is not directly available in the structure, passed by address to this callback function. It is possible to reach it, but you need to follow pointers to internal Ruby interpreter structures, and I'm not sure if these are stable, since they're not part of the public API, and will probably change often with Ruby versions.

@github-actions
Copy link

Benchmark Report
BenchmarkRuby (no tracing)JSONCAPNPJSON (PureRuby)
heavy_work55ms✓ 705ms 78,110,721B576ms 203,842B✓ 42,348ms 211,728,983B

@nickysn nickysn merged commit 0843c98 into main Sep 23, 2025
4 of 5 checks passed
@nickysn nickysn deleted the thread_support branch September 23, 2025 15:20
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

Successfully merging this pull request may close these issues.

3 participants