Home » Community » Coffee corner » Map implementation
Re: Map implementation [message #51569 is a reply to message #51565] |
Wed, 17 April 2019 16:13   |
Novo
Messages: 1430 Registered: December 2006
|
Ultimate Contributor |
|
|
mirek wrote on Wed, 17 April 2019 02:54
Well, nothing surprising there, right?
Yes, but ...
$ ./test_ht_perf
Mem used: 78128 Kb
Index<int> Add: 7.035
Index<int> Unlink: 12.272
Mem used: 2592740 Kb
Mem used after Sweep: 3800292 Kb
Mem used: 3769040 Kb
std::set<int> insert: 7.381
std::set<int> erase: 4.296
Mem used: 7603920 Kb
if (true) {
Vector<Index<int> > v;
v.SetCount(v_num);
const int isize = 100;
Cout() << "Mem used: " << MemoryUsedKb() - curMU << " Kb" << EOL;
TimeStop ts;
for (int i = 0; i < isize; ++i) {
const int jsize = v_num;
for (int j = 0; j < jsize; ++j)
v[j].Add(i);
}
Cout() << "Index<int> Add: " << ts.ToString() << EOL;
ts.Reset();
for (int i = 0; i < isize; ++i) {
const int jsize = v_num;
for (int j = 0; j < jsize; ++j)
v[j].UnlinkKey(i);
}
Cout() << "Index<int> Unlink: " << ts.ToString() << EOL;
Cout() << "Mem used: " << MemoryUsedKb() - curMU << " Kb" << EOL;
const int jsize = v_num;
for (int j = 0; j < jsize; ++j)
v[j].Sweep();
Cout() << "Mem used after Sweep: " << MemoryUsedKb() - curMU << " Kb" << EOL;
}
if (true) {
std::set<int>* v;
v = new std::set<int>[v_num];
const int isize = 100;
Cout() << "Mem used: " << MemoryUsedKb() - curMU << " Kb" << EOL;
TimeStop ts;
for (int i = 0; i < isize; ++i) {
const int jsize = v_num;
for (int j = 0; j < jsize; ++j)
v[j].insert(i);
}
Cout() << "std::set<int> insert: " << ts.ToString() << EOL;
ts.Reset();
for (int i = 0; i < isize; ++i) {
const int jsize = v_num;
for (int j = 0; j < jsize; ++j)
v[j].erase(i);
}
Cout() << "std::set<int> erase: " << ts.ToString() << EOL;
Cout() << "Mem used: " << MemoryUsedKb() - curMU << " Kb" << EOL;
}
Project is attached.
std::set<int> erase is three times faster than Index<int> Unlink.
After calling Index::Sweep even more memory is used. I guess this is a problem with the allocator.
And Index invalidates pointers.
So ...
Regards,
Novo
|
|
|
 |
|
Map implementation
|
 |
|
Re: Map implementation
By: mirek on Fri, 22 March 2019 07:18
|
 |
|
Re: Map implementation
By: Novo on Wed, 27 March 2019 03:33
|
 |
|
Re: Map implementation
|
 |
|
Re: Map implementation
By: Novo on Tue, 02 April 2019 17:48
|
 |
|
Re: Map implementation
By: Novo on Tue, 02 April 2019 18:39
|
 |
|
Re: Map implementation
|
 |
|
Re: Map implementation
By: mirek on Mon, 08 April 2019 22:37
|
 |
|
Re: Map implementation
|
 |
|
Re: Map implementation
By: mirek on Tue, 09 April 2019 17:16
|
 |
|
Re: Map implementation
By: mirek on Wed, 10 April 2019 11:07
|
 |
|
Re: Map implementation
|
 |
|
Re: Map implementation
By: Novo on Wed, 10 April 2019 17:09
|
 |
|
Re: Map implementation
By: mirek on Wed, 10 April 2019 17:37
|
 |
|
Re: Map implementation
By: Novo on Sat, 13 April 2019 20:58
|
 |
|
Re: Map implementation
By: Novo on Sat, 13 April 2019 21:07
|
 |
|
Re: Map implementation
By: mirek on Sun, 14 April 2019 08:03
|
 |
|
Re: Map implementation
By: Novo on Sun, 14 April 2019 18:55
|
 |
|
Re: Map implementation
By: mirek on Sun, 14 April 2019 19:52
|
 |
|
Re: Map implementation
By: mirek on Tue, 16 April 2019 12:38
|
 |
|
Re: Map implementation
By: Novo on Tue, 16 April 2019 16:38
|
 |
|
Re: Map implementation
By: mirek on Tue, 16 April 2019 19:33
|
 |
|
Re: Map implementation
By: Novo on Tue, 16 April 2019 22:36
|
 |
|
Re: Map implementation
By: Novo on Wed, 17 April 2019 05:40
|
 |
|
Re: Map implementation
By: mirek on Wed, 17 April 2019 08:54
|
 |
|
Re: Map implementation
By: Novo on Wed, 17 April 2019 16:13
|
 |
|
Re: Map implementation
By: mirek on Wed, 17 April 2019 18:39
|
 |
|
Re: Map implementation
By: mirek on Fri, 07 June 2019 13:58
|
 |
|
Re: Map implementation
By: Novo on Tue, 25 June 2019 15:20
|
 |
|
Re: Map implementation
By: mirek on Wed, 26 June 2019 12:07
|
 |
|
Re: Map implementation
By: Novo on Mon, 01 July 2019 06:26
|
 |
|
Re: Map implementation
By: mirek on Mon, 01 July 2019 17:53
|
 |
|
Re: Map implementation
By: Novo on Sat, 13 April 2019 21:25
|
 |
|
Re: Map implementation
By: Novo on Wed, 10 April 2019 16:13
|
 |
|
Re: Map implementation
By: mirek on Wed, 10 April 2019 17:50
|
 |
|
Re: Map implementation
By: Novo on Wed, 10 April 2019 16:48
|
Goto Forum:
Current Time: Sat May 10 21:02:22 CEST 2025
Total time taken to generate the page: 0.03403 seconds
|