|
-
December 2nd, 2002, 07:35 AM
#1
map type issue
i whant to know if i can load to a map(STL) type
1000000 recordes and work with it fine.
did this will damege the performence?
if i will run process with this type and work with it it will be ok?
-
December 2nd, 2002, 08:14 AM
#2
It depends on what you will do with this map, but it can be slow. Consider at least putting pointers to the records inside the map as opposed to the real objects.
You might also consider using hash_map instead, it's quite a bit faster on big data provided that your hash function is good and fast.
Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
Supports C++ and VB out of the box, but can be configured for other languages.
-
December 2nd, 2002, 03:20 PM
#3
Yes, a map is one solution. There is minimal performance loss if the content of the map is sortable. Thus, the map sorts the contents in a binary tree, making it at most n - 1 height. There will experience performance loss if the contents are 1, 1, 1, 1, 1, 1, etc. such that the tree is of height n - 1.
Kuphryn
-
December 2nd, 2002, 10:32 PM
#4
Hum, well I think that most implementations use Red-Black trees to implement maps, so it will balance itself "automagically".
Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
Supports C++ and VB out of the box, but can be configured for other languages.
-
December 2nd, 2002, 11:12 PM
#5
Yeah, the STL is magical!
Kuphryn
-
December 3rd, 2002, 02:19 AM
#6
thanks.
what about the memory?
shoud i allocate memory on the stack? ( local var )
or on the heap? ( whit dynamic allocation )
-
December 3rd, 2002, 02:24 AM
#7
Program design greatly impacts memory allocation. Consider where and when you will access the map.
Kuphryn
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|