Ilia Minkin
Ilia Minkin

Reputation: 11

Changing the size of stxxl:vector cache

In my algorithm I have two stages:

1) Populating a file with records using a big data structure X that takes as much RAM as possible 2) Sorting the file. Now there is lot of memory since X is deallocated

So I would like to handle file and its sorting with STXXL. But, on the first stage, there is very limited space for STXXL cache, while on the second one there should be a plenty.

So ideally, I would like to create an stxxl::vector in the first stage with small cache, fill it, and then increase its size during sorting to speed things up. However, I can't find a function to change vector's cache size.

One solution that I see is to write to a plain "dummy" binary file during the first stage, and create a stxxl::vector from it, but it will lead to double usage of the space, since both "dummy" file and stxxl::vector will exist simultaneously at some point. So what is the true way to utilize stxxl for this?

Upvotes: 0

Views: 147

Answers (1)

Daniel F
Daniel F

Reputation: 283

In general, the stxxl::vector's cache size can be changed by setting the CachePages-Parameter as described in stxxl::VECTOR_GENERATOR. Does that answer your question?

Upvotes: 0

Related Questions