You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
larsbak opened this issue
Mar 7, 2013
· 3 comments
Labels
area-vmUse area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)
The code below has been created to measure the impact of using type parameters in "new" expressions. If such a new expression is combined with an "is" check the benchmark is 10 times slower. Please note complex also uses twice the heap memory. Canonicalization or caching of type information is needed to fix this.
//Lars
// Method used Heap VmRSS Runtime
// complex ~320MB 7.2 sec.
// complextWithCheck ~205MB 31.7 sec.
// simple ~154MB 2.6 sec.
// simpleWithCheck ~154MB 3.2 sec.
class B { B(); }
class A<T> { A(); }
class C<S,T> {
A<T> complex() => new A<T>();
A<T> complexWithCheck() {
var a = new A<T>();
return a is A<T> ? a : a;
}
B simple() => new B();
B simpleWithCheck() {
var b = new B();
return b is B ? b : b;
}
}
main() {
const int max = 10000000;
final a = new C<B,B>();
final c = new List(max);
for (int i = 0; i < max; i++) c[i] = a.simple();
}
The text was updated successfully, but these errors were encountered:
area-vmUse area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)
The code below has been created to measure the impact of using type parameters in "new" expressions. If such a new expression is combined with an "is" check the benchmark is 10 times slower. Please note complex also uses twice the heap memory. Canonicalization or caching of type information is needed to fix this.
//Lars
// Method used Heap VmRSS Runtime
// complex ~320MB 7.2 sec.
// complextWithCheck ~205MB 31.7 sec.
// simple ~154MB 2.6 sec.
// simpleWithCheck ~154MB 3.2 sec.
class B { B(); }
class A<T> { A(); }
class C<S,T> {
A<T> complex() => new A<T>();
A<T> complexWithCheck() {
var a = new A<T>();
return a is A<T> ? a : a;
}
B simple() => new B();
B simpleWithCheck() {
var b = new B();
return b is B ? b : b;
}
}
main() {
const int max = 10000000;
final a = new C<B,B>();
final c = new List(max);
for (int i = 0; i < max; i++) c[i] = a.simple();
}
The text was updated successfully, but these errors were encountered: