Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
cython
Commits
f4e84f3c
Commit
f4e84f3c
authored
Aug 28, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimise cypclass dict iteration
parent
39a8e429
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
Cython/Includes/libcythonplus/dict.pxd
Cython/Includes/libcythonplus/dict.pxd
+19
-8
No files found.
Cython/Includes/libcythonplus/dict.pxd
View file @
f4e84f3c
...
@@ -42,6 +42,17 @@ cdef extern from * nogil:
...
@@ -42,6 +42,17 @@ cdef extern from * nogil:
return *this;
return *this;
}
}
dict_iterator_t & operator=(base_iterator_t rhs)
{
swap(static_cast<base&>(*this), rhs);
if (urange != NULL) {
urange->_active_iterators--;
urange->CyObject_DECREF();
urange = NULL;
}
return *this;
}
~dict_iterator_t()
~dict_iterator_t()
{
{
if (urange != NULL) {
if (urange != NULL) {
...
@@ -160,12 +171,12 @@ cdef extern from * nogil:
...
@@ -160,12 +171,12 @@ cdef extern from * nogil:
iterator begin() const
iterator begin() const
{
{
return iterator(std::begin(
*urange
), urange);
return iterator(std::begin(
urange->_items
), urange);
}
}
iterator
end() const
typename iterator::base
end() const
{
{
return std::end(
*urange
);
return std::end(
urange->_items
);
}
}
};
};
...
@@ -207,21 +218,21 @@ cdef extern from * nogil:
...
@@ -207,21 +218,21 @@ cdef extern from * nogil:
view_dict_keys
()
view_dict_keys
()
view_dict_keys
(
dict_t
)
view_dict_keys
(
dict_t
)
key_iterator_t
[
dict_t
,
base_iterator_t
,
reference_t
]
begin
()
key_iterator_t
[
dict_t
,
base_iterator_t
,
reference_t
]
begin
()
key_iterator_t
[
dict_t
,
base_iterator_t
,
reference_t
]
end
()
base_iterator_t
end
()
cdef
cppclass
view_dict_values
[
dict_t
,
base_iterator_t
,
reference_t
]:
cdef
cppclass
view_dict_values
[
dict_t
,
base_iterator_t
,
reference_t
]:
ctypedef
value_iterator_t
[
dict_t
,
base_iterator_t
,
reference_t
]
iterator
ctypedef
value_iterator_t
[
dict_t
,
base_iterator_t
,
reference_t
]
iterator
view_dict_values
()
view_dict_values
()
view_dict_values
(
dict_t
)
view_dict_values
(
dict_t
)
value_iterator_t
[
dict_t
,
base_iterator_t
,
reference_t
]
begin
()
value_iterator_t
[
dict_t
,
base_iterator_t
,
reference_t
]
begin
()
value_iterator_t
[
dict_t
,
base_iterator_t
,
reference_t
]
end
()
base_iterator_t
end
()
cdef
cppclass
view_dict_items
[
dict_t
,
base_iterator_t
,
reference_t
]:
cdef
cppclass
view_dict_items
[
dict_t
,
base_iterator_t
,
reference_t
]:
ctypedef
item_iterator_t
[
dict_t
,
base_iterator_t
,
reference_t
]
iterator
ctypedef
item_iterator_t
[
dict_t
,
base_iterator_t
,
reference_t
]
iterator
view_dict_items
()
view_dict_items
()
view_dict_items
(
dict_t
)
view_dict_items
(
dict_t
)
item_iterator_t
[
dict_t
,
base_iterator_t
,
reference_t
]
begin
()
item_iterator_t
[
dict_t
,
base_iterator_t
,
reference_t
]
begin
()
item_iterator_t
[
dict_t
,
base_iterator_t
,
reference_t
]
end
()
base_iterator_t
end
()
cdef
cypclass
cypdict
[
K
,
V
]:
cdef
cypclass
cypdict
[
K
,
V
]:
...
@@ -295,8 +306,8 @@ cdef cypclass cypdict[K, V]:
...
@@ -295,8 +306,8 @@ cdef cypclass cypdict[K, V]:
key_iterator_t
[
cypdict
[
K
,
V
],
vector
[
item_type
].
iterator
,
key_type
]
begin
(
self
):
key_iterator_t
[
cypdict
[
K
,
V
],
vector
[
item_type
].
iterator
,
key_type
]
begin
(
self
):
return
key_iterator_t
[
cypdict
[
K
,
V
],
vector
[
item_type
].
iterator
,
key_type
](
self
.
_items
.
begin
(),
self
)
return
key_iterator_t
[
cypdict
[
K
,
V
],
vector
[
item_type
].
iterator
,
key_type
](
self
.
_items
.
begin
(),
self
)
key_iterator_t
[
cypdict
[
K
,
V
],
vector
[
item_type
].
iterator
,
key_type
]
end
(
self
):
vector
[
item_type
].
iterator
end
(
self
):
return
key_iterator_t
[
cypdict
[
K
,
V
],
vector
[
item_type
].
iterator
,
key_type
](
self
.
_items
.
end
()
)
return
self
.
_items
.
end
(
)
size_type
__len__
(
self
):
size_type
__len__
(
self
):
return
self
.
_items
.
size
()
return
self
.
_items
.
size
()
...
...
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