Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using STL in large project

21 views
Skip to first unread message

Alex Vinokur

unread,
Mar 30, 1999, 3:00:00 AM3/30/99
to
In article <7do3c9$ab1$1...@talia.mad.ttd.net>,
"Jorge" <cafelit...@yahoo.com> wrote:
> Hi:
>
> We're thinking about use sgi's STL in a really large project.
> Process speed it's very important for this project and since I've
> only tried STL in little projects, I've got no idea how a very large
> data set will affect a STL project based.
>
> what do you think about?
>
> thanks in advance
> Jorge
>
>


Hi,

Here are some aspects of comparative analisis
of STL and Standard C Library.

The following functions (methods, operators) were measured.

----------------------------------------------------
Standard C Library | STL
----------------------------------------------------
strcpy | operator= (string)
strcat | operator+= (string)
strlen | size () (string)
char* | constructor&destructor (string)
char-array | constructor&destructor (string)
malloc&free | new&delete (string)
(malloc+init)&free | new&delete (string)
----------------------------------------------------

Average time-cost of execution was obtained.

Here are the results of the experiment.

//##########################################################################
//################# Results of the experiment ##############################
// SunOS 5.6 Generic_105181-09 sun4m sparc SUNW,SPARCstation-5
// g++ version 2.8.1
//##########################################################################

##### Test#1 #####
Test#1 [strcpy() ] : Average time = 890 nsec
Test#1 [STL : operator=] : Average time = 515 nsec

Test#1 [strcat() ] : Average time = 86770 nsec
Test#1 [STL : operator+=] : Average time = 4682 nsec

Test#1 [strlen() ] : Average time = 98352 nsec
Test#1 [STL : size () ] : Average time = 286 nsec

Test#1 [char*] : Average time = 133 nsec
Test#1 [char-array] : Average time = 751 nsec
Test#1 [STL : constructor&destructor] : Average time = 3226 nsec

Test#1 [malloc&free] : Average time = 4735 nsec
Test#1 [(malloc+init)&free] : Average time = 4573 nsec
Test#1 [STL : new&delete] : Average time = 6947 nsec

##### Test#2 #####
Test#2 [strcpy() ] : Average time = 678 nsec
Test#2 [STL : operator=] : Average time = 521 nsec

Test#2 [strcat() ] : Average time = 83619 nsec
Test#2 [STL : operator+=] : Average time = 2485 nsec

Test#2 [strlen() ] : Average time = 97888 nsec
Test#2 [STL : size () ] : Average time = 286 nsec

Test#2 [char*] : Average time = 131 nsec
Test#2 [char-array] : Average time = 750 nsec
Test#2 [STL : constructor&destructor] : Average time = 3604 nsec

Test#2 [malloc&free] : Average time = 4070 nsec
Test#2 [(malloc+init)&free] : Average time = 5863 nsec
Test#2 [STL : new&delete] : Average time = 6867 nsec

##### Test#3 #####
Test#3 [strcpy() ] : Average time = 679 nsec
Test#3 [STL : operator=] : Average time = 523 nsec

Test#3 [strcat() ] : Average time = 88326 nsec
Test#3 [STL : operator+=] : Average time = 2426 nsec

Test#3 [strlen() ] : Average time = 135749 nsec
Test#3 [STL : size () ] : Average time = 287 nsec

Test#3 [char*] : Average time = 131 nsec
Test#3 [char-array] : Average time = 826 nsec
Test#3 [STL : constructor&destructor] : Average time = 3059 nsec

Test#3 [malloc&free] : Average time = 4066 nsec
Test#3 [(malloc+init)&free] : Average time = 4809 nsec
Test#3 [STL : new&delete] : Average time = 7244 nsec

##### Test#4 #####
Test#4 [strcpy() ] : Average time = 846 nsec
Test#4 [STL : operator=] : Average time = 521 nsec

Test#4 [strcat() ] : Average time = 88333 nsec
Test#4 [STL : operator+=] : Average time = 2424 nsec

Test#4 [strlen() ] : Average time = 102409 nsec
Test#4 [STL : size () ] : Average time = 286 nsec

Test#4 [char*] : Average time = 132 nsec
Test#4 [char-array] : Average time = 751 nsec
Test#4 [STL : constructor&destructor] : Average time = 3060 nsec

Test#4 [malloc&free] : Average time = 4142 nsec
Test#4 [(malloc+init)&free] : Average time = 4490 nsec
Test#4 [STL : new&delete] : Average time = 7092 nsec

##### Test#5 #####
Test#5 [strcpy() ] : Average time = 845 nsec
Test#5 [STL : operator=] : Average time = 887 nsec

Test#5 [strcat() ] : Average time = 88568 nsec
Test#5 [STL : operator+=] : Average time = 2421 nsec

Test#5 [strlen() ] : Average time = 104744 nsec
Test#5 [STL : size () ] : Average time = 286 nsec

Test#5 [char*] : Average time = 130 nsec
Test#5 [char-array] : Average time = 751 nsec
Test#5 [STL : constructor&destructor] : Average time = 3058 nsec

Test#5 [malloc&free] : Average time = 4138 nsec
Test#5 [(malloc+init)&free] : Average time = 4489 nsec
Test#5 [STL : new&delete] : Average time = 7026 nsec

//##########################################################################

For more details please see the threads titeled

1) "STL and Usual C : Average time-cost of execution"
in comp.lang.c++.moderated,
comp.lang.c++

The link is :
http://x11.dejanews.com/dnquery.xp?search=thread&svcclass=dnserver&threaded=1
&ST=PS&CONTEXT=914841639.1172307970&HIT_CONTEXT=914841639.1172307970&HIT_NUM=
19&recnum=%3c36822F3...@tibam.elex.co.il%3e%231/3

2) "Corrected and Supplemented -> Re: STL and Usual C :
Average time-cost of execution"
in comp.lang.c++.moderated,
comp.lang.c++

The link is :
http://x14.dejanews.com/dnquery.xp?search=thread&svcclass=dnserver&threaded=1
&ST=PS&CONTEXT=914915711.1193541737&HIT_CONTEXT=914915711.1193541737&HIT_NUM=
0&recnum=%3c368734F...@tibam.elex.co.il%3e%231/3

//##########################################################################

I think you need to evaluate several aspects
regarding performance (computional complexity)
of STL and Standatd C Library
and to do them comparative analysis.


Alex

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

0 new messages