Project

General

Profile

Actions

Feature #13544

closed

Allow loading an ISeqs sequence directly from a C extension without requiring buffer is in an RVALUE

Added by sam.saffron (Sam Saffron) almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Target version:
-
[ruby-core:80996]

Description

Currently the only way to load an InstructionSequence is to load the data into a Ruby RVALUE and then pass it to #load_from_binary

This is inefficient as it forces one extra potentially very large RVALUE slot.

It would be nice if c extensions could load an instruction sequence directly from c buffer.

Updated by ko1 (Koichi Sasada) almost 7 years ago

  • Status changed from Open to Closed
  • Assignee set to ko1 (Koichi Sasada)

I agree. mruby has such feature and CRuby also should implement it.
For example, we should use it for rubygems and didyoumean gem which loaded at all load-time.

I close it and will make new ticket when I (or someone smart) make this feature.

Updated by normalperson (Eric Wong) almost 7 years ago

wrote:

https://bugs.ruby-lang.org/issues/13544

Currently the only way to load an InstructionSequence is to load the data into a Ruby RVALUE and then pass it to #load_from_binary

This is inefficient as it forces one extra potentially very large RVALUE slot.

Can using String#clear help your case right now?

It would be nice if c extensions could load an instruction sequence directly from c buffer.

Maybe adding mmap support (at least read-only) to IO objects can
support this...

There will be portability problems, though; and we need to be
careful about the file being changed (especially truncated)
while reading via mmap is happening.

Updated by ko1 (Koichi Sasada) almost 7 years ago

On 2017/05/05 5:36, Eric Wong wrote:

Maybe adding mmap support (at least read-only) to IO objects can
support this...

FYI:
https://github.com/ko1/yomikomu gem use mmap
(https://github.com/ko1/mmapped_string).
(but no big impact though)

--
// SASADA Koichi at atdot dot net

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0