[Mono-devel-list] Mono ASP.NET is very slow with big html pages...

Hubert FONGARNAND informatique.internet at fiducial.fr
Fri May 13 02:35:32 EDT 2005


Hello,
We've rewritten our programm without using any "server side" text-size 
calculation...
I just use the client browser, (a table without any fixed width can adapt his 
size automatically)
Now, my pages loads as fast as MS.NET
But, the problem isn't here 
System.Drawing font measure function is incredibly slower and CPU intensive 
than MS.NET... I can do benchmarks if you want... (i've gentoo linux and 
WS2003 on the same machine)

Le Jeudi 12 Mai 2005 19:50, Rafael Teixeira a écrit :
> Also, you can create that font only once (cache it by the Name and
> Size) and reuse in many pages, just beware o memory consumption, if
> you doesn't limit the choices for fonts and sizes.
>
> I also reiterate what Ben said, doesn't calculate things on the
> server, because things will go diferently on the client. To add
> another issue (besides user-chosen-css, installed fonts) the
> resolution may be different, what makes the same font render quite
> differently.
>
> HIH,
>
> On 5/12/05, Ben Maurer <bmaurer at ximian.com> wrote:
> > On Thu, 2005-05-12 at 11:04 +0200, Hubert FONGARNAND wrote:
> > > I apologize, i've found my problem...
> > > This slowdown is due to System.Drawing
> > >
> > > Let me explain...
> > > Mono renders a page with more than 100 menu, for each menu, the largest
> > > item size is calculated by this function :
> > >
> > >                 SizeF size;
> > >                   float emSize =
> > > Convert.ToSingle(fontInfo.Size.Unit.Value); emSize = (emSize==0 ?8
> > > :emSize);
> > >                   Font stringFont = new Font(fontInfo.Name, emSize);
> > >                   Graphics g=new Bitmap(1,1);
> > >                   size = g.MeasureString(text, stringFont);
> > >                 g.Dispose();
> > >                   return size;
> > >
> > > After doing some tests, i've seen that the slowest line is :
> > >                   Font stringFont = new Font(fontInfo.Name, emSize);
> > > So the creation of this Font object (the font is Arial) is extremely
> > > slow comparing to MS.NET...
> > > If I remove this line, the page loads as fast as MS.NET (a little bit
> > > faster...)
> > >
> > > Is there a way to optimize System.Drawing for this problem;
> > > or is there a better way to measure a text string length (with variable
> > > font size) without using this very slow function...
> >
> > I'm not sure how much we can speed that up. I can take a look at how
> > Cairo does the stuff.
> >
> > However, if I understand what you are doing correctly, you are trying to
> > measure a string on the server and see how large it will be on the
> > client. I am not sure how well that will work. On the client side,
> > people might have different fonts installed, or might even use a user
> > css sheet. Nonetheless, we should still try to be faster here.
> >
> > -- Ben
> >
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
_______________________________________________
Ce message et les éventuels documents joints peuvent contenir des informations confidentielles.
Au cas où il ne vous serait pas destiné, nous vous remercions de bien vouloir le supprimer et en aviser immédiatement l'expéditeur. Toute utilisation de ce message non conforme à sa destination, toute diffusion ou publication, totale ou partielle et quel qu'en soit le moyen est formellement interdite.
Les communications sur internet n'étant pas sécurisées, l'intégrité de ce message n'est pas assurée et la société émettrice ne peut être tenue pour responsable de son contenu.



More information about the Mono-devel-list mailing list