Guidelines about using eachindex and inbounds #2465
JohnAAbbott
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In my (prototype) code for computing Hilbert series numerators there are several "low level" functions which do lots of indexing into
Vector{Int64}
objects. These functions are currently internal to my implementation (so they mostly do not do any argument checking).Since the functions are quite low level, I am tempted to use the Julia macro
@inbounds
which disables range checks on indexes; the hope is that the code will become perceptibly faster. Of course, the Julia documentation warns of the potential perils of using@inbounds
. The documentation also suggests usingeachindex(v)
to obtain the range of valid indexes rather than using an explicit range such as1:length(v)
.Does OSCAR have guidelines about this? (beyond those in the Julia documentation, I mean)
Beta Was this translation helpful? Give feedback.
All reactions