Skip to content

Commit f540208

Browse files
author
x0r
committed
Perf: Any call operation id() only for supported types #903
Operation id() is only available for types: for tk_objref, tk_struct, tk_union, tk_enum, tk_alias, tk_value, tk_value_box, tk_native, tk_abstract_interface tk_local_interface, tk_except tk_component, tk_home and tk_event. In other cases exception is generated and performance degraded on my tests up to 9%. In case of exception the whole try/catch have no sense. See CORBA 3.3 standard Chapter 8.11.1 "The TypeCode Interface" for list of types.
1 parent e0939c9 commit f540208

File tree

1 file changed

+36
-14
lines changed

1 file changed

+36
-14
lines changed

Diff for: TAO/tao/AnyTypeCode/TypeCode.cpp

+36-14
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,44 @@ CORBA::TypeCode::equivalent (TypeCode_ptr tc) const
9191
if (tc_kind != this_kind)
9292
return false;
9393

94-
try
94+
switch (this_kind)
9595
{
96-
char const * const this_id = unaliased_this->id ();
97-
char const * const tc_id = unaliased_tc->id ();
98-
99-
if (ACE_OS::strlen (this_id) != 0
100-
&& ACE_OS::strlen (tc_id) != 0)
101-
{
102-
return ACE_OS::strcmp (this_id, tc_id) == 0;
103-
}
104-
}
105-
catch (const ::CORBA::TypeCode::BadKind&)
96+
case tk_objref:
97+
case tk_struct:
98+
case tk_union:
99+
case tk_enum:
100+
case tk_alias:
101+
case tk_value:
102+
case tk_value_box:
103+
case tk_native:
104+
case tk_abstract_interface:
105+
case tk_local_interface:
106+
case tk_except:
107+
case tk_component:
108+
case tk_home:
109+
case tk_event:
106110
{
107-
// Some TypeCodes do not support the id() operation. Ignore the
108-
// failure, and continue equivalence verification using TypeCode
109-
// subclass-specific techniques.
111+
try
112+
{
113+
char const * const this_id = unaliased_this->id ();
114+
char const * const tc_id = unaliased_tc->id ();
115+
116+
if (ACE_OS::strlen (this_id) != 0
117+
&& ACE_OS::strlen (tc_id) != 0)
118+
{
119+
return ACE_OS::strcmp (this_id, tc_id) == 0;
120+
}
121+
}
122+
catch (const ::CORBA::TypeCode::BadKind&)
123+
{
124+
// Some TypeCodes do not support the id() operation. Ignore the
125+
// failure, and continue equivalence verification using TypeCode
126+
// subclass-specific techniques.
127+
}
128+
break;
129+
}
130+
default:
131+
; // Do nothing
110132
}
111133

112134
return unaliased_this->equivalent_i (unaliased_tc.in ());

0 commit comments

Comments
 (0)