About std::vector::resize().

Dhruv Matani dhruvbird@gmx.net
Sun May 30 09:21:00 GMT 2004


Hello,
	Here is the initial testing patch.

You will have to manually add the patched file stl_type_traits.h to the
include/bits directory for testing purposes, because I do not know how
to write makefiles ;-(

Here are the numbers for the extreme test-case for the patched and
un-patched vector. The test-case is attached.


*******PATCHED**********
[dhruv@localhost test]$ compile vec_vec_test.cpp v4 -O3
The Compiler command passed is: g++34 -Wall -O3 -o vec_vec_test
vec_vec_test.cpp
[dhruv@localhost test]$ ./vec_vec_test 
[dhruv@localhost test]$ time ./vec_vec_test

real    0m0.525s
user    0m0.400s
sys     0m0.120s

*******UN_PATCHED*********
[dhruv@localhost test]$ compile vec_vec_test.cpp -O3
The Compiler command passed is: g++ -Wall -O3 -o vec_vec_test
vec_vec_test.cpp
[dhruv@localhost test]$ time ./vec_vec_test

real    1m40.819s
user    1m30.410s
sys     0m0.120s



On Sat, 2004-05-29 at 13:32, Paolo Carlini wrote:
> Dhruv Matani wrote:
> 
> >Thanks ;-)
> >
> >Actually, this patch is because of my own selfish needs. I use currently
> >std::vector<std::vector<char> > very heavily in a file processing app.
> >of mine, and figured that would help with this optimization, so I
> >thought about it.
> >  
> >
> That's ok... provided the final result doesn't apply only to 
> vector<vector>>, of
> course... ;) ;)
> 
> Paolo.
-- 
        -Dhruv Matani.
http://www.geocities.com/dhruvbird/

Proud to be a Vegetarian.
http://www.vegetarianstarterkit.com/
http://www.vegkids.com/vegkids/index.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_swappable_vector.dhruv
Type: text/x-patch
Size: 12957 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040530/49222edb/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vec_vec_test.cpp
Type: text/x-c++
Size: 554 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040530/49222edb/attachment-0001.bin>


More information about the Libstdc++ mailing list