Skip to content

Commit 29edf39

Browse files
committed
perf: add inbounds keywords
1 parent 14ef786 commit 29edf39

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/neighbours.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ function (cell_list::CellList)(system::Particles, i::Int)
214214
neighbour_cells = cell_list.neighbour_cells[c]
215215
# Scan the neighbourhood of cell mc (including itself)
216216
# and from there scan atoms in cell c2
217-
return (j for c2 in neighbour_cells for j in @inbounds cell_list.cells[c2])
217+
return (j for c2 in @inbounds neighbour_cells for j in @inbounds cell_list.cells[c2])
218218
end
219219

220220

@@ -331,17 +331,17 @@ function Base.iterate(neighbour_list::LinkedIterator, state=-1)
331331
return nothing
332332
end
333333
c, c_state = next
334-
j = neighbour_list.head[c]
334+
@inbounds j = neighbour_list.head[c]
335335
else
336336
c_state, j = state
337-
j = neighbour_list.list[j]
337+
@inbounds j = neighbour_list.list[j]
338338
if j == -1
339339
next = iterate(neighbour_list.neighbour_cells, c_state)
340340
if next == nothing
341341
return nothing
342342
end
343343
c, c_state = next
344-
j = neighbour_list.head[c]
344+
@inbounds j = neighbour_list.head[c]
345345
end
346346
end
347347

0 commit comments

Comments
 (0)