Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
llvm-watermarker
Project
Project
Details
Activity
Releases
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
nagayama15
llvm-watermarker
Commits
7f423559
Commit
7f423559
authored
Jan 20, 2019
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zlib伸長関数のベンチマークを無効化
parent
fda8ef19
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
benchmark.cpp
example/zlib/benchmark.cpp
+16
-0
No files found.
example/zlib/benchmark.cpp
View file @
7f423559
...
...
@@ -22,6 +22,7 @@ namespace
::
deflateEnd
(
&
zs
);
}
#if defined(ENABLE_INFLATE_BENCHMARK)
void
decompression_test
(
const
std
::
vector
<
std
::
byte
>&
compressed_test_data
,
std
::
vector
<
std
::
byte
>&
buffer
)
{
::
z_stream
zs
=
{};
...
...
@@ -34,6 +35,7 @@ namespace
::
inflate
(
&
zs
,
Z_FINISH
);
::
inflateEnd
(
&
zs
);
}
#endif
template
<
typename
F
>
std
::
clock_t
measure
(
F
&&
f
)
...
...
@@ -67,6 +69,7 @@ int main()
return
data
;
}();
#if defined(ENABLE_INFLATE_BENCHMARK)
// Compressed `test_data`.
const
auto
compressed_test_data
=
[
&
]()
{
...
...
@@ -84,8 +87,13 @@ int main()
return
std
::
vector
<
std
::
byte
>
(
std
::
begin
(
data
),
std
::
end
(
data
));
}();
#endif
#if defined(ENABLE_INFLATE_BENCHMARK)
std
::
puts
(
"compression[us]
\t
decompression[us]"
);
#else
std
::
puts
(
"compression[us]"
);
#endif
constexpr
std
::
size_t
n
=
100
;
...
...
@@ -98,15 +106,23 @@ int main()
compression_test
(
raw_test_data
,
output_buffer
,
9
);
});
#if defined(ENABLE_INFLATE_BENCHMARK)
const
auto
decompression_time
=
measure
([
&
]()
{
decompression_test
(
compressed_test_data
,
output_buffer
);
});
#endif
#if defined(ENABLE_INFLATE_BENCHMARK)
std
::
printf
(
"%f
\t
%f
\n
"
,
1e6
*
compression_time
/
CLOCKS_PER_SEC
,
1e6
*
decompression_time
/
CLOCKS_PER_SEC
);
#else
std
::
printf
(
"%f
\n
"
,
1e6
*
compression_time
/
CLOCKS_PER_SEC
);
#endif
std
::
fflush
(
stdout
);
}
...
...
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