First NIT release and new clean mercurial repository
[nit.git] / tests / bench_send2.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2004-2008 Jean Privat <jean@pryen.org>
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 redef class Object
18 meth foo do end
19 end
20 class A
21 redef meth foo do end
22 init do end
23 end
24 class B
25 special A
26 redef meth foo do end
27 redef init do end
28
29 end
30 class C
31 special A
32 redef init do end
33
34 end
35 class D
36 special B
37 special C
38 redef init do end
39
40 end
41 class E
42 special B
43 special C
44 redef meth foo do end
45 redef init do end
46
47 end
48 class F
49 special D
50 special E
51 redef meth foo do end
52 redef init do end
53
54 end
55
56 var nb = 60
57 var a = new Array[Object].with_capacity(nb)
58 for i in [0..(nb/6)[ do
59 a[i*6] = new A
60 a[i*6+1] = new B
61 a[i*6+2] = new C
62 a[i*6+3] = new D
63 a[i*6+4] = new E
64 a[i*6+5] = new F
65 end
66 for i in [0..1000000[ do
67 for j in [0..nb[ do
68 a[j].foo
69 end
70 end
71