summaryrefslogtreecommitdiff
path: root/benchmark/bm_io_copy_stream_write.rb
blob: 3fd87250a4a9135b0905170a1af267e260033700 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# The goal of this is to use a synthetic (non-IO) reader
# to trigger the read/write loop of IO.copy_stream,
# bypassing in-kernel mechanisms like sendfile for zero copy,
# so we wrap the /dev/zero IO object:

class Zero
  def initialize
    @n = 100000
    @in = File.open('/dev/zero', 'rb')
  end

  def read(len, buf)
    return if (@n -= 1) == 0
    @in.read(len, buf)
  end
end

begin
  src = Zero.new
  dst = File.open(IO::NULL, 'wb')
  n = IO.copy_stream(src, dst)
rescue Errno::ENOENT
  # not *nix
end if IO.respond_to?(:copy_stream) && IO.const_defined?(:NULL)
mpatibility of changes in header files. This will force the developer to recompile their gems to use the same header files as the built Ruby. In Ruby, the ABI version is exposed through `RbConfig::CONFIG["ruby_abi_version"]`. Notes: Merged: https://github.com/ruby/ruby/pull/5474 2021-10-30Get rid of exponential backtracks found by CodeQLNobuyoshi Nakada Since these regexps are used at build/installation, they are not vulnerabilities. Notes: Merged: https://github.com/ruby/ruby/pull/5056 2021-04-15mkconfig.rb: Update around SDKROOTNobuyoshi Nakada c.f. https://opensource.apple.com/source/ruby/ruby-145.40.1/patches/tool_mkconfig.rb.diff * moved to "includedir" from "oldincludedir". * honor "$(prefix)/include" if exists, otherwise fallback to `xcrun`. 2021-03-22Add `RbConfig::CONFIG["platform"]`Nobuyoshi Nakada Means the platform with the actual CPU info on universal binary. The CPU in "arch" is fixed as "universal" to refer the header and library paths. Notes: Merged: https://github.com/ruby/ruby/pull/4300 Merged-By: nobu <[email protected]> 2021-01-07rbconfig.rb: extract cpu from RUBY_PLATFORM when universalNobuyoshi Nakada 2020-03-30[DOC] Updated module name [ci skip]Nobuyoshi Nakada 2020-03-25Make RbConfig::CONFIG values mutable [Bug #16738]Nobuyoshi Nakada As `RbConfig.expand` modifies the argument and involved `CONFIG` values, its values should be mutable. 2020-03-21[ci skip]Fix return type on RbConfig.fire_update!taki Notes: Merged: https://github.com/ruby/ruby/pull/2972 2019-12-20Fixed misspellingsNobuyoshi Nakada Fixed misspellings reported at [Bug #16437], only in ruby and rubyspec. 2019-12-04MJIT_CC and MJIT_SUPPORT are not a prefixTakashi Kokubun 0b19e15a1239bff9ae854f522f954206ec910cf8 was also for "MJIT_SUPPORT" too. 2019-12-04Prefer using MJIT_CC for JIT support checkTakashi Kokubun because Solaris might have CC=cc and we'd like to check full path MJIT_CC=/opt/developerstudio12.5/bin/cc instead.