473,503 Members | 2,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Will many ToolTip providers cause a performance issue?

I have an application where some forms have many (say 100) UserControls on
them (each of which contain a label, an image, and a data entry control),
and each UserControl has a ToolTip provider (although really we don't assign
ToolTips to most of the controls), and then the UserControl exposes a
ToolTipText property which sets the same ToolTip for all 3 contained
controls. It would be possible to have one ToolTip provider on the form
instead, it would be ugly (especially since I think the form level ToolTip
provider would put provider-properties on the designer property thingy that
we'd want to NEVER use.)

Anyway, our more complex forms are loading kinda slow, and my supervisor
wonders if it would help performance if each control did not have its own
ToolTip provider. I think this is not the big issue, but I don't know enough
about how the ToolTip works internally to feel sure. I suppose the only real
way to know is try removing them, and see if it helps, but that will be a
real pain, and if anyone has enough knowledge to say we really should be
looking somewhere else, that'd be appreciated. Or to say yes, removing the
100 ToolTip providers is really worth trying (either way.)

-Rachel
Nov 17 '05 #1
8 3052
Tool tips are provided through an extender provider that associates the
tooltip message with the control via a hashtable. You should not have many
tooltip object, just one...

The tooltip system works by adding a handler to the controls mouse-hover
event and then showing the message associated with the control. There should
be no particular performance loss.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Rachel Suddeth" <ra****@bldhound.com> wrote in message
news:OS**************@TK2MSFTNGP12.phx.gbl...
I have an application where some forms have many (say 100) UserControls on
them (each of which contain a label, an image, and a data entry control),
and each UserControl has a ToolTip provider (although really we don't
assign
ToolTips to most of the controls), and then the UserControl exposes a
ToolTipText property which sets the same ToolTip for all 3 contained
controls. It would be possible to have one ToolTip provider on the form
instead, it would be ugly (especially since I think the form level ToolTip
provider would put provider-properties on the designer property thingy
that
we'd want to NEVER use.)

Anyway, our more complex forms are loading kinda slow, and my supervisor
wonders if it would help performance if each control did not have its own
ToolTip provider. I think this is not the big issue, but I don't know
enough
about how the ToolTip works internally to feel sure. I suppose the only
real
way to know is try removing them, and see if it helps, but that will be a
real pain, and if anyone has enough knowledge to say we really should be
looking somewhere else, that'd be appreciated. Or to say yes, removing the
100 ToolTip providers is really worth trying (either way.)

-Rachel

Nov 17 '05 #2
Thanks, Bob...
The tooltip system works by adding a handler to the controls mouse-hover
event and then showing the message associated with the control. There should be no particular performance loss.
I take it you are saying there is not much overhead in having many
hashtables with only a few (or no) entries each, then having one hashtable
with many entries? Obviously, the latter is more efficient, but I think not
a big deal?
Tool tips are provided through an extender provider that associates the
tooltip message with the control via a hashtable. You should not have many
tooltip object, just one...


The problem with sticking one ToolTip provider onto the form when you are
using UserControls is that if you do SetToolTip(control, tiptext), that will
associate the text only with UserControl's mouse events, not with the
contained controls' events. If the contained controls cover the entire
surface of the UserControl (as most of them do for us), then the TipText
will never show up. Instead, we have one for each UserControl, and the set
of the TipText does something like
set
{
foreach ( Control c in this.Controls )
{
this.TipProvider.SetToolTip( c, value );
}
}
(Really, it's a bit more complicated that this because sometimes the
contained control can itself be a container.) The contained controls are
private members of the UserControl, and we'd like to keep it that way, so
using a single ToolTip for the whole for would be messy and involve the
UserControl having access to the form's ToolTip provider.

-Rachel
Nov 17 '05 #3
Rachel,

The first thing I'd do, if I were you, instead of spending a lot of time
trying to optimize things you're not sure will make a difference, is profile
your app and find out specifically where the bottleneck is. That way you
won't waste a great deal of time on things that may not make any noticeable
difference.

I highly recommend nprof. It works really well and it's free:

http://nprof.sourceforge.net/Site/SiteHomeNews.html

My job is primarily developping custom controls, and for some of them,
performance is a high priority issue. nprof has been a life saver.

Pete

"Rachel Suddeth" <ra****@bldhound.com> wrote in message
news:ef**************@TK2MSFTNGP12.phx.gbl...
Thanks, Bob...
The tooltip system works by adding a handler to the controls mouse-hover
event and then showing the message associated with the control. There

should
be no particular performance loss.


I take it you are saying there is not much overhead in having many
hashtables with only a few (or no) entries each, then having one hashtable
with many entries? Obviously, the latter is more efficient, but I think
not
a big deal?
Tool tips are provided through an extender provider that associates the
tooltip message with the control via a hashtable. You should not have
many
tooltip object, just one...


The problem with sticking one ToolTip provider onto the form when you are
using UserControls is that if you do SetToolTip(control, tiptext), that
will
associate the text only with UserControl's mouse events, not with the
contained controls' events. If the contained controls cover the entire
surface of the UserControl (as most of them do for us), then the TipText
will never show up. Instead, we have one for each UserControl, and the set
of the TipText does something like
set
{
foreach ( Control c in this.Controls )
{
this.TipProvider.SetToolTip( c, value );
}
}
(Really, it's a bit more complicated that this because sometimes the
contained control can itself be a container.) The contained controls are
private members of the UserControl, and we'd like to keep it that way, so
using a single ToolTip for the whole for would be messy and involve the
UserControl having access to the form's ToolTip provider.

-Rachel

Nov 17 '05 #4
I have not found that hashtable performance was much of a problem under many
hundreds of entries. If your form has many hundreds of items then it's
probably way too busy and you should be doing something else.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Rachel Suddeth" <ra****@bldhound.com> wrote in message
news:ef**************@TK2MSFTNGP12.phx.gbl...
Thanks, Bob...
The tooltip system works by adding a handler to the controls mouse-hover
event and then showing the message associated with the control. There

should
be no particular performance loss.


I take it you are saying there is not much overhead in having many
hashtables with only a few (or no) entries each, then having one hashtable
with many entries? Obviously, the latter is more efficient, but I think
not
a big deal?
Tool tips are provided through an extender provider that associates the
tooltip message with the control via a hashtable. You should not have
many
tooltip object, just one...


The problem with sticking one ToolTip provider onto the form when you are
using UserControls is that if you do SetToolTip(control, tiptext), that
will
associate the text only with UserControl's mouse events, not with the
contained controls' events. If the contained controls cover the entire
surface of the UserControl (as most of them do for us), then the TipText
will never show up. Instead, we have one for each UserControl, and the set
of the TipText does something like
set
{
foreach ( Control c in this.Controls )
{
this.TipProvider.SetToolTip( c, value );
}
}
(Really, it's a bit more complicated that this because sometimes the
contained control can itself be a container.) The contained controls are
private members of the UserControl, and we'd like to keep it that way, so
using a single ToolTip for the whole for would be messy and involve the
UserControl having access to the form's ToolTip provider.

-Rachel

Nov 17 '05 #5

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:OH*************@TK2MSFTNGP09.phx.gbl...
I have not found that hashtable performance was much of a problem under many hundreds of entries. If your form has many hundreds of items then it's
probably way too busy and you should be doing something else.


Oh, dear, I have not been clear. I am saying that IF there is a performance
difference, it will be more efficient to use only one hashtable. I am sure
the hastable could easily handle all the entries ... it would be a poor
hashtable implementation if it couldn't (which seems terribly unlikely given
that hashtables aren't hard to implement and Microsoft has very smart
programmers.) It's rather a waste of space to use a hashtable for only 2 or
3 entries... but I doubt that's our biggest problem.

Anyway, thanks for the info... I thought it would use a hashtable (that's
what I'd use if writing a provider), but it's nice to have that confirmed.

-Rachel
Nov 17 '05 #6
Thanks, Pete. I will get this right away. I do think it's time for us to use
something this.
-Rachel

"Pete Davis" <pdavis68@[nospam]hotmail.com> wrote in message
news:JM******************************@giganews.com ...
Rachel,

The first thing I'd do, if I were you, instead of spending a lot of time
trying to optimize things you're not sure will make a difference, is profile your app and find out specifically where the bottleneck is. That way you
won't waste a great deal of time on things that may not make any noticeable difference.

I highly recommend nprof. It works really well and it's free:

http://nprof.sourceforge.net/Site/SiteHomeNews.html

My job is primarily developping custom controls, and for some of them,
performance is a high priority issue. nprof has been a life saver.

Pete

Nov 17 '05 #7
Oh, why didn't I catch on to this?...

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
...
The tooltip system works by adding a handler to the controls mouse-hover
event ...


In that case, I should be able to add a MouseHover handler to all the
controls on each user control like so...

private void BaseCtrl_ControlAdded(object sender, ControlEventArgs e)
{
Control c = sender as Control;
c.MouseHover += new EventHandler(c_MouseHover);
}

private void c_MouseHover(object sender, EventArgs e)
{
this.OnMouseHover(e);
}

Then I should be able to use the ToolTip as intended, because hovering over
any contained control should trigger the UserControl's MouseHover, right?

-Rachel
Nov 17 '05 #8
On Mon, 7 Nov 2005 09:08:57 -0600, "Rachel Suddeth"
<ra****@bldhound.com> wrote:
Thanks, Pete. I will get this right away. I do think it's time for us to use
something this.
-Rachel
In your original post you mention that some forms have over 100 user
controls and each user control contains three controls including an
image. Just knowing this it becomes obvious a whole lot, perhaps too
much, is going on as the form loads. Loading 100+ images sounds like a
lot of repetitive I/O. Populating 100+ data controls will slow things
down as well.

As a programmer I have to question to the design and as a designer I
have to question the usability of a window with 100+ controls. Such
complexity cannot be user-friendly.

regards
A.G.
"Pete Davis" <pdavis68@[nospam]hotmail.com> wrote in message
news:JM******************************@giganews.co m...
Rachel,

The first thing I'd do, if I were you, instead of spending a lot of time
trying to optimize things you're not sure will make a difference, is

profile
your app and find out specifically where the bottleneck is. That way you
won't waste a great deal of time on things that may not make any

noticeable
difference.

I highly recommend nprof. It works really well and it's free:

http://nprof.sourceforge.net/Site/SiteHomeNews.html

My job is primarily developping custom controls, and for some of them,
performance is a high priority issue. nprof has been a life saver.

Pete

Nov 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
5336
by: Michael | last post by:
Is there any way to modify the tooltip that shows up when using alt or title in <img> or <a> tags? I don't like the stock tooltip, the boring yellow box. I would like to make it a little more...
2
1481
by: runningdog | last post by:
Hi, I have created a number of Windows Forms Controls that require tooltips. If I add a tooltip object to each of my controls will this create any resource/performance issues that I should be...
2
2194
by: fochie | last post by:
Greetings, First time append. I have a dynamic page that can potentially contain thousands of links. Each link has an onmouseover specified with Walter Zorn's Tool Tip feature to pop up a...
3
4126
by: Pascal Weill | last post by:
Hello, I've got a problem with the ToolTip control (it is the first time I use it). Whatever the changes I make to the xxxxDelay properties (for example 1000), the tooltip appears immediately...
3
2102
by: Dennis | last post by:
I have implemented the ToolTip class for a user control that inheirits from the panel. I show different tool tips depending on where the mouse is on the control when the hover event occurs. ...
5
1257
by: ODAN | last post by:
I have an application that was developed in ASP.NET/C#. On one of the pages, we are using tooltip to display the description of the textboxes. Wehn you move your mouse over a textbox the tooltip...
0
1440
by: sonu | last post by:
Hi all, I am experiencing a strange problem for the call setToolTip while running my application on frmaework 2.0. I have found 2 messages on google discussing the same issue but there are no...
1
2513
by: Mike | last post by:
Hi: I have been trying to create a web application that provides suport for two membership/profile databases: one for private users and one for another set of users. These tw user have a...
0
1574
Pakmarshal
by: Pakmarshal | last post by:
Hello Everyone, While working with list view control in VB 2005, I observed a behavior that the tooltip for the control is not consistent i.e. if we closely observe that when the tooltip displays...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.