[#104004] [Ruby master Feature#17883] Load bundler/setup earlier to make `bundle exec ruby -r` respect Gemfile — mame@...
Issue #17883 has been reported by mame (Yusuke Endoh).
21 messages
2021/05/24
[ruby-core:103739] [Ruby master Bug#17851] ruby extension for memoryview
From:
dsisnero@...
Date:
2021-05-05 13:57:33 UTC
List:
ruby-core #103739
Issue #17851 has been reported by dsisnero (Dominic Sisneros).
----------------------------------------
Bug #17851: ruby extension for memoryview
https://bugs.ruby-lang.org/issues/17851
* Author: dsisnero (Dominic Sisneros)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
add an extension to ruby for memoryview - (just like Fiddle::MemoryView but in ruby assuming Fiddle::MemoryView gets slices)
add a method in Kernel to get initialize a memoryview on an object that is a c memoryview
lets say we want to partially copy a file - minus the first KB
``` ruby
f = File.open('test.txt', 'rb') do |f|
content = f.read
content_to_write = memoryview(content)[1024..-1] # here is what I want new -it will use the same memory as content just pointers
puts "content length #{content.size} - content_to_write length #{content_to_write.size}"
File.open('output.txt','wb') do |f2|
f2.write(content_to_write) # if we have #17832 this will write to file without copying
end
end
```
If we have memoryview extension in ruby we can use less memory because we are no longer copying Strings when doing slices
#17831
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>