Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cb-1
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Philipp Jacob
cb-1
Commits
535a603e
Commit
535a603e
authored
2 years ago
by
Alexander Schultheiß
Browse files
Options
Downloads
Patches
Plain Diff
Updated benchmarking
parent
4fdbb59b
Branches
main
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/stack.rs
+6
-8
6 additions, 8 deletions
src/stack.rs
with
6 additions
and
8 deletions
src/stack.rs
+
6
−
8
View file @
535a603e
...
...
@@ -109,30 +109,28 @@ mod tests {
fn
benchmark
()
{
let
(
pushed
,
popped
)
=
bench
(
ListStack
::
init
());
println!
(
"Own implementation took {}s for push and {} for pop."
,
"Own implementation took {}
m
s for push and {} for pop."
,
pushed
,
popped
);
println!
(
"Sleeping for 10 seconds."
);
sleep
(
Duration
::
from_secs
(
10
));
let
(
pushed
,
popped
)
=
bench
(
Vec
::
init
());
println!
(
"Vec wrapper took {}s for push and {} for pop."
,
"Vec wrapper took {}
m
s for push and {} for pop."
,
pushed
,
popped
);
}
fn
bench
<
T
:
Stack
>
(
mut
stack
:
T
)
->
(
u
64
,
u64
)
{
fn
bench
<
T
:
Stack
>
(
mut
stack
:
T
)
->
(
u
128
,
u128
)
{
let
start
=
Instant
::
now
();
for
i
in
1
..
BENCHMARK_SIZE
{
stack
.push_val
(
i
);
}
println!
(
"Pushed all elements"
);
let
pushed
=
start
.elapsed
()
.as_secs
();
let
pushed
=
start
.elapsed
()
.as_millis
();
let
start
=
Instant
::
now
();
while
stack
.pop_val
()
.is_some
()
{}
println!
(
"Popped all elements"
);
let
popped
=
start
.elapsed
()
.as_
sec
s
();
let
popped
=
start
.elapsed
()
.as_
milli
s
();
(
pushed
,
popped
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment