c# - WPF application runs faster in debug mode -
i've been working on wpf application visualizes complex functions colored rectangles on canvas. @ moment 40.000 rectangles drawn @ same time when button clicked. problem applications needs few seconds if executed in debug mode (f5) whereas takes 1 minute if executed without debbuging (ctrl + f5) until rectangles drawn on canvas. analyzing memory shows memory usage increases faster in debug mode in normal mode.
for better understanding: have loop goes through complex numbers between (-5, -5) (5, 5) in 0.05 steps. each calculated value color rectangle evaluated depending on phase , magnitude.
edit: loop starts after button clicked , c instance of complex class , r, double values safe current values of complex number:
c = new complex(-5, -5); while(c.real < 5){ r = c.real; rsum = 0.0d; while(c.imaginary < 5){ showrect(c); = this.c.imaginary; c = new complex(r, + 0.05); isum += 0.05d; } r = c.real; c = new complex(r + 0.05, -5); rsum += 0.05d; } private void showrect(complex c){ //some calculation stuff res result value rect = new rectangle(); //setting properties of rectangle object rect.fill = evalcolor(res); canvas.children.add(rect); private solidcolorbrush evalcolor(complex com){ if(com.phase <= -35 * math.pi / 36) return new solidcolorbrush(color.fromrgb(1, 1, 1)); else if(...) //same scheme every statement
does know why this? found 1 thread without answers written years ago. thankful help.
greetings , have nice day
Comments
Post a Comment