File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. This
2
+ # code is released under a tri EPL/GPL/LGPL license. You can use it,
3
+ # redistribute it and/or modify it under the terms of the:
4
+ #
5
+ # Eclipse Public License version 2.0, or
6
+ # GNU General Public License version 2, or
7
+ # GNU Lesser General Public License version 2.1.
8
+
9
+ if RUBY_ENGINE == 'truffleruby'
10
+ map = TruffleRuby ::ConcurrentMap . new
11
+ 10_000 . times { |i | map [ i ] = i }
12
+ map [ :a ] = 1
13
+
14
+ benchmark 'TruffleRuby::ConcurrentMap#[]' do
15
+ map [ :a ]
16
+ end
17
+
18
+ benchmark 'TruffleRuby::ConcurrentMap#[]=' do
19
+ map [ :set ] = :value
20
+ end
21
+
22
+ benchmark 'TruffleRuby::ConcurrentMap#each_pair' do
23
+ map . each_pair { |k , v | k }
24
+ end
25
+
26
+ benchmark 'TruffleRuby::ConcurrentMap#delete' do
27
+ map [ :to_delete ] = true
28
+ map . delete ( :to_delete )
29
+ end
30
+ end
You can’t perform that action at this time.
0 commit comments