We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2db8c40 commit 68015c1Copy full SHA for 68015c1
test/bench/ffi/bench_getuid.rb
@@ -0,0 +1,25 @@
1
+require 'benchmark'
2
+require 'ffi'
3
+
4
+iter = 100000
5
6
+module Posix
7
+ extend FFI::Library
8
+ attach_function :getuid, [], :uid_t
9
+end
10
11
12
+puts "uid=#{Process.pid} Posix.getuid=#{Posix.getuid}"
13
+puts "Benchmark FFI getuid performance, #{iter}x calls"
14
15
+10.times {
16
+ puts Benchmark.measure {
17
+ iter.times { Posix.getuid }
18
+ }
19
+}
20
+puts "Benchmark Process.uid performance, #{iter}x calls"
21
22
23
+ iter.times { Process.uid }
24
25
0 commit comments