Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
Practical-Cryptdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Zhaozhen
Practical-Cryptdb
Commits
1785ef27
Commit
1785ef27
authored
Jan 24, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use move in test_memory
parent
0ab4db45
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
11 deletions
+19
-11
.test_memory.cc.swp
debug/.test_memory.cc.swp
+0
-0
test_memory.cc
debug/test_memory.cc
+17
-9
reuse.cc
wrapper/reuse.cc
+2
-2
No files found.
debug/.test_memory.cc.swp
0 → 100644
View file @
1785ef27
File added
debug/test_memory.cc
View file @
1785ef27
...
@@ -18,7 +18,7 @@ using std::string;
...
@@ -18,7 +18,7 @@ using std::string;
using
std
::
to_string
;
using
std
::
to_string
;
static
std
::
string
embeddedDir
=
"/t/cryt/shadow"
;
static
std
::
string
embeddedDir
=
"/t/cryt/shadow"
;
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
string
>>
gfm
;
/*init global full backup. */
/*init global full backup. */
static
static
...
@@ -26,6 +26,7 @@ void initGfb(vector<string> field_names,
...
@@ -26,6 +26,7 @@ void initGfb(vector<string> field_names,
vector
<
int
>
field_types
,
vector
<
int
>
field_types
,
vector
<
int
>
field_lengths
,
vector
<
int
>
field_lengths
,
std
::
string
db
,
std
::
string
table
){
std
::
string
db
,
std
::
string
table
){
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
string
>>
gfm
;
std
::
string
prefix
=
std
::
string
(
"data/"
)
+
db
+
"/"
+
table
+
"/"
;
std
::
string
prefix
=
std
::
string
(
"data/"
)
+
db
+
"/"
+
table
+
"/"
;
for
(
unsigned
int
i
=
0u
;
i
<
field_names
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0u
;
i
<
field_names
.
size
();
i
++
)
{
std
::
string
filename
=
prefix
+
field_names
[
i
];
std
::
string
filename
=
prefix
+
field_names
[
i
];
...
@@ -36,25 +37,32 @@ void initGfb(vector<string> field_names,
...
@@ -36,25 +37,32 @@ void initGfb(vector<string> field_names,
load_string_file
(
filename
,
column
,
field_lengths
[
i
]);
load_string_file
(
filename
,
column
,
field_lengths
[
i
]);
}
}
gfm
[
field_names
[
i
]]
=
std
::
move
(
column
);
gfm
[
field_names
[
i
]]
=
std
::
move
(
column
);
// vector<string>().swap(gfm[field_names[i]]);
}
//get memory 31%
}
//get memory 31%
for
(
unsigned
int
i
=
0u
;
i
<
field_names
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0u
;
i
<
field_names
.
size
();
i
++
)
{
gfm
.
erase
(
field_names
[
i
]);
vector
<
string
>
().
swap
(
gfm
[
field_names
[
i
]
]);
}
}
return
;
return
;
}
}
class
token
{
public
:
int
a
;
token
()
:
a
(
0
){}
};
int
int
main
(
int
argc
,
char
*
argv
[]){
main
(
int
argc
,
char
*
argv
[]){
vector
<
int
>
lengths
{
20
,
15
,
256
,
11
};
vector
<
int
>
lengths
{
20
,
15
,
256
,
20
};
vector
<
int
>
types
{
8
,
8
,
253
,
8
};
vector
<
int
>
types
{
8
,
8
,
253
,
8
};
std
::
vector
<
std
::
string
>
names
{
"BLWQNYLYOWoEq"
,
std
::
vector
<
std
::
string
>
names
{
"JKIIHGGNTDoEq"
,
"HZYMDVEERKoOrder"
,
"UOURXXPAMUoOrder"
,
"HEPOWBSYEVoADD"
,
"WAVWPSYCINoADD"
,
"OHGNYTNLSCoASHE"
,
"cdb_saltMAANVANOOE"
"cdb_saltNDFPJCCDAO"
};
};
// token * pp = new token[80000000];
// delete [] pp;
initGfb
(
names
,
types
,
lengths
,
"micro_db"
,
"int_table"
);
initGfb
(
names
,
types
,
lengths
,
"micro_db"
,
"int_table"
);
return
0
;
return
0
;
}
}
...
...
wrapper/reuse.cc
View file @
1785ef27
...
@@ -434,7 +434,7 @@ void load_num_file(std::string filename,std::vector<std::string> &res){
...
@@ -434,7 +434,7 @@ void load_num_file(std::string filename,std::vector<std::string> &res){
std
::
ifstream
infile
(
filename
);
std
::
ifstream
infile
(
filename
);
std
::
string
line
;
std
::
string
line
;
while
(
std
::
getline
(
infile
,
line
)){
while
(
std
::
getline
(
infile
,
line
)){
res
.
push_back
(
line
);
res
.
push_back
(
std
::
move
(
line
)
);
}
}
infile
.
close
();
infile
.
close
();
}
}
...
@@ -455,7 +455,7 @@ void load_string_file(std::string filename, std::vector<std::string> &res,unsign
...
@@ -455,7 +455,7 @@ void load_string_file(std::string filename, std::vector<std::string> &res,unsign
int
fd
=
open
(
filename
.
c_str
(),
O_RDONLY
);
int
fd
=
open
(
filename
.
c_str
(),
O_RDONLY
);
if
(
fd
==-
1
)
assert
(
0
);
//reading from -1 may cause errors
if
(
fd
==-
1
)
assert
(
0
);
//reading from -1 may cause errors
while
(
read
(
fd
,
buf
,
length
)
!=
0
){
while
(
read
(
fd
,
buf
,
length
)
!=
0
){
res
.
push_back
(
std
::
string
(
buf
,
length
));
res
.
push_back
(
std
::
move
(
std
::
string
(
buf
,
length
)
));
}
}
close
(
fd
);
close
(
fd
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment