From: sam.saffron@... Date: 2019-10-07T22:25:23+00:00 Subject: [ruby-core:95269] [Ruby master Feature#16029] Expose fstring related APIs to C-extensions Issue #16029 has been updated by sam.saffron (Sam Saffron). I think the larger change here is allowing for a new type of API. From a performance perspective the people using the new API would like to avoid allocating an RVALUE unless needed, the current fstring APIs require an RVALUE unless you give it a constant string I think? Perhaps what we need here is the ability to ask Ruby: "Hey do you have an fstring for cstr X? If so then you use it, otherwise you do the slow path of allocating an RVALUE and passing it in to the fstring function. ---------------------------------------- Feature #16029: Expose fstring related APIs to C-extensions https://bugs.ruby-lang.org/issues/16029#change-81945 * Author: byroot (Jean Boussier) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- As discussed with @tenderlove here: https://github.com/ruby/ruby/pull/2287#issuecomment-513865160 We'd like to update various data format parsers (JSON, MessagePack, etc) to add the possibility to deduplicate strings while parsing. But unfortunately the `rb_fstring_*` family of functions isn't available to C-extensions, so the only available fallback is `rb_funcall(str, rb_intern("-@"))` which most parsers will likely consider too slow. So the various `rb_fstring_*` functions would need to be public. Proposed patch: https://github.com/ruby/ruby/pull/2299 -- https://bugs.ruby-lang.org/ Unsubscribe: