Skip to content
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

Merged
merged 8 commits into from
Sep 24, 2014

Conversation

garborg
Copy link
Collaborator

@garborg garborg commented Sep 24, 2014

No description provided.

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.
@garborg
Copy link
Collaborator Author

garborg commented Sep 24, 2014

I swear I wrote a description... one sec....

@garborg
Copy link
Collaborator Author

garborg commented Sep 24, 2014

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)
Copy link
Collaborator Author

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).

Copy link
Owner

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.

@garborg
Copy link
Collaborator Author

garborg commented Sep 24, 2014

That's all I have for this PR.

@garborg
Copy link
Collaborator Author

garborg commented Sep 24, 2014

I fixed the alignment issue in the example code.

Is there anything to do with the functions I commented on here (cropList! and createGraph)?

tedsteiner added a commit that referenced this pull request Sep 24, 2014
Idiomatic code and low hanging efficiency gains
@tedsteiner tedsteiner merged commit 8d80b88 into tedsteiner:master Sep 24, 2014
@tedsteiner
Copy link
Owner

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.

@garborg
Copy link
Collaborator Author

garborg commented Sep 24, 2014

Great! It felt good to rip through some simpler, less profiling-/testing-required commits to get familiar with with the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants