Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ASP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
j2-tulloch
ASP
Commits
fe63e89f
Commit
fe63e89f
authored
1 year ago
by
j2-tulloch
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
afd26b08
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Worksheet2/test3.cpp
+33
-0
33 additions, 0 deletions
Worksheet2/test3.cpp
with
33 additions
and
0 deletions
Worksheet2/test3.cpp
0 → 100644
+
33
−
0
View file @
fe63e89f
#include
<chrono>
#include
<iostream>
#include
"bumpalld.hpp"
//#include "bumpall.hpp"
void
benchmarkBumpAllocator
()
{
const
size_t
blockSize
=
1000000
;
// Size of the memory block
BumpAllocator
allocator
(
blockSize
);
// Example allocation/deallocation operations
for
(
int
i
=
0
;
i
<
10000
;
++
i
)
{
allocator
.
allocate
(
100
);
// Allocate 100 bytes
allocator
.
reset
();
// Reset the allocator for the next iteration
}
}
int
main
()
{
using
std
::
chrono
::
high_resolution_clock
;
using
std
::
chrono
::
duration_cast
;
using
std
::
chrono
::
duration
;
using
std
::
chrono
::
milliseconds
;
auto
t1
=
high_resolution_clock
::
now
();
benchmarkBumpAllocator
();
auto
t2
=
high_resolution_clock
::
now
();
auto
ms_int
=
duration_cast
<
milliseconds
>
(
t2
-
t1
);
duration
<
double
,
std
::
milli
>
ms_double
=
t2
-
t1
;
std
::
cout
<<
ms_int
.
count
()
<<
"ms
\n
"
;
std
::
cout
<<
ms_double
.
count
()
<<
"ms
\n
"
;
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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