Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Simox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Leander Singer
Simox
Commits
71b13200
Commit
71b13200
authored
5 years ago
by
Fabian Paus
Browse files
Options
Downloads
Patches
Plain Diff
SoftMinMax: Improve performance by caching the maximal heap size
parent
62fd9b86
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SimoxUtility/math/SoftMinMax.cpp
+3
-1
3 additions, 1 deletion
SimoxUtility/math/SoftMinMax.cpp
SimoxUtility/math/SoftMinMax.h
+2
-0
2 additions, 0 deletions
SimoxUtility/math/SoftMinMax.h
with
5 additions
and
1 deletion
SimoxUtility/math/SoftMinMax.cpp
+
3
−
1
View file @
71b13200
...
...
@@ -37,6 +37,8 @@ namespace simox::math
}
this
->
percentile
=
percentile
;
this
->
num_elements
=
numValues
;
allowed_heap_size_cache
=
allowed_heap_size
();
}
void
SoftMinMax
::
add
(
float
value
)
...
...
@@ -49,7 +51,7 @@ namespace simox::math
throw
std
::
logic_error
(
msg
.
str
());
}
if
(
min_queue
.
size
()
<
allowed_heap_size
()
)
if
(
min_queue
.
size
()
<
allowed_heap_size
_cache
)
{
// Heaps not full yet
min_queue
.
push
(
value
);
...
...
This diff is collapsed.
Click to expand it.
SimoxUtility/math/SoftMinMax.h
+
2
−
0
View file @
71b13200
...
...
@@ -66,6 +66,8 @@ namespace simox::math
/// The number of elements to be added.
std
::
size_t
num_elements
=
0
;
std
::
size_t
allowed_heap_size_cache
=
0
;
using
Container
=
std
::
vector
<
float
>
;
using
MaxCompare
=
std
::
less
<
float
>
;
// Results in max heap.
...
...
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