-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idiomatic code and low hanging efficiency gains #32
Conversation
Most changes also improve performance. The exception being that `for val in vec` is a bit slower than `for i in 1:length(vec); vec[i]; end`, but where that matters, we'd want to go further -- i.e. clean syntax by default, `for i in 1:length(vec); @inbounds vec[i]; end` where indexing is a noticeable bottleneck.
Also tightened up a couple loops that involved splatting
A few of the tests from are no longer passing on julia 0.4 (at this commit or at the commit that passed Travis from the last PR) -- apparently something has changed in on the julia master branch since the commit of the julia nightly the last PR ran against. There are bigger to fry now, but I'll open an issue.
I swear I wrote a description... one sec.... |
Basically, apart from making whitespace consistent and idiomatic, the rest was just swapping in idiomatic functions, etc., where I noticed an opportunity -- some functions will be faster, but I didn't profile to target anything -- it was just a general sweep through the codebase. A lot was touched, but the commits are pretty atomic, so if anything is of particular interest, looking at the specific commit is probably easier and may provide commit-specific comments. There was something I saw that I want to ask you about before merging (I left it untouched -- just want to make sure it was right) -- I'll point it out in the code now. |
@@ -172,11 +172,11 @@ function onBounds(loc::ENU, bounds::Bounds) | |||
end | |||
|
|||
### Remove specified items from an array ### | |||
function cropList!(list::Array, crop_list::BitArray{1}) | |||
function cropList!(list::Array, crop_list::BitVector) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you plan to use this function in the future? (it's not used or exported).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this is a remnant from the way I was cropping before, if its not being used. The crop_list indicated which nodes were out of bounds.
That's all I have for this PR. |
I fixed the alignment issue in the example code. Is there anything to do with the functions I commented on here ( |
Idiomatic code and low hanging efficiency gains
Everything you've done here looks awesome to me, thanks a lot! I actually learned a lot by going through all the changes and seeing how someone might do things differently. |
Great! It felt good to rip through some simpler, less profiling-/testing-required commits to get familiar with with the project. |
No description provided.