Mais conteúdo relacionado
Semelhante a mmapパッケージを使ってお手軽オブジェクト管理 (20)
Mais de Shintaro Fukushima (13)
mmapパッケージを使ってお手軽オブジェクト管理
- 7. 遅っ・・・!
(CPU: Intel Core i7)
> # Data Expo 2009のデータを読み込む(2008年度分)
> system.time(x <- read.csv("../data/2008.csv"))
ユーザ システム 経過
70.790 6.730 78.874
7
- 11. > # Data Expo 2009のデータ(2008年度分,657MB)
> system.time(x <- read.csv("../data/2008.csv"))
ユーザ システム 経過
70.790 6.730 78.874
> object.size(x)
813470376 bytes
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 181957 9.8 407500 21.8 350000 18.7
Vcells 101932893 777.7 310681082 2370.4 310100488 2365.9
11
- 12. 確かに最初はmmap形式にデータを
変換するのに時間はかかるが
一旦生成すればメモリへの負担は軽い
> system.time(y <- as.mmap(x, file="2008.mmap"))
ユーザ システム 経過
26.340 75.590 352.476
> object.size(y)
264 bytes
> rm(x)
12
- 17. class BigDataFrame : boost::noncopyable
{
public:
enum DataType {CHAR=1, SHORT=2, INT=3, DOUBLE=4, COMPLEX=5};
public:
BigDataFrame(index_type nrow, index_type ncol) : nrow_(nrow), ncol_(ncol) {
// initializing shared pointer
p = std::shared_ptr<Monitor>(new Monitor[ncol],
std::default_delete<Monitor[]>());
まずはbigmemoryのデータフレーム
版を目指して開発していきたい
期待せずに待っていてください・・・
template <typename T>
struct RecordValueVisitor : boost::static_visitor<>
{
RecordValueVisitor(T const& v) : val_(v) { }
void operator ()(std::vector<T>& vec) const {
vec.push_back(this->val_);
}
private:
T val_;
};
17