G
Guest
I was curious if anybody else noticed this fact. Everytime you use the font class, especially creating multiple instances of the Font class in an iteration, there is a significant performance hit. The way I noticed was due to a bug in my code. I have a list class where each item is a separate object with various properties, among which a Font. At some point I wanted to test my list with a lot of items so I made a loop that was creating like 10000 items, but I used a constructor that passes a font too and I used new Font(...). To my surprize and astonishement, it took an average of 7 milliisecond for the framework to create each item. I got into a sort of panic, as I thought that my event model was too extensive or I forget to dispose some objects. It turned up that when I removed the Font object from the costructor with a null, the average time went from 7 milliseconds to 0.02 miliseconds!! That is like 350 times faster... Now I am even worried about any place that I might use the font constructor. Did anybody noticed this behavior in other instances? Does anyone know an optimized way of using fonts
thank you
Iulian
thank you
Iulian