Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
e798f40f
Commit
e798f40f
authored
Jan 04, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1039 from corona10/finalizer
Micro optimization on 'gc_invalidateOrderedFinalizerList'
parents
7e586778
9e4d6aee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
src/gc/collector.cpp
src/gc/collector.cpp
+9
-8
No files found.
src/gc/collector.cpp
View file @
e798f40f
...
...
@@ -47,7 +47,7 @@ FILE* trace_fp;
std
::
deque
<
Box
*>
pending_finalization_list
;
std
::
deque
<
PyWeakReference
*>
weakrefs_needing_callback_list
;
std
::
list
<
Box
*>
objects_with_ordered_finalizers
;
std
::
vector
<
Box
*>
objects_with_ordered_finalizers
;
static
std
::
unordered_set
<
void
*>
roots
;
static
std
::
vector
<
std
::
pair
<
void
*
,
void
*>>
potential_root_ranges
;
...
...
@@ -379,18 +379,19 @@ void invalidateOrderedFinalizerList() {
static
StatCounter
sc_us
(
"us_gc_invalidate_ordered_finalizer_list"
);
Timer
_t
(
"invalidateOrderedFinalizerList"
,
/*min_usec=*/
10000
);
for
(
auto
iter
=
objects_with_ordered_finalizers
.
begin
();
iter
!=
objects_with_ordered_finalizers
.
end
();)
{
Box
*
box
=
*
iter
;
auto
needToRemove
=
[](
Box
*
box
)
->
bool
{
GCAllocation
*
al
=
GCAllocation
::
fromUserData
(
box
);
if
(
!
hasOrderedFinalizer
(
box
->
cls
)
||
hasFinalized
(
al
))
{
// Cleanup.
GC_TRACE_LOG
(
"Removing %p from objects_with_ordered_finalizers
\n
"
,
box
);
iter
=
objects_with_ordered_finalizers
.
erase
(
iter
)
;
return
true
;
}
else
{
++
iter
;
return
false
;
}
}
};
objects_with_ordered_finalizers
.
erase
(
std
::
remove_if
(
objects_with_ordered_finalizers
.
begin
(),
objects_with_ordered_finalizers
.
end
(),
needToRemove
),
objects_with_ordered_finalizers
.
end
());
long
us
=
_t
.
end
();
sc_us
.
log
(
us
);
...
...
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