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

An R package that wraps your code #10

Open
Jean-Romain opened this issue Mar 18, 2020 · 5 comments
Open

An R package that wraps your code #10

Jean-Romain opened this issue Mar 18, 2020 · 5 comments

Comments

@Jean-Romain
Copy link

Hi,

I wrapped your C++ code into an package for the R language. See RcppConcaveman. Then I tried it and I compared it to the R package concaveman that is a wrapper to the original JavaScript code from mapbox using V8.

I found that the output of your implementation is different than the one from the original version. See image below. The read is the original one, the blue is yours

Rplot

Also I benchmarked it and I found that it was slower than the original JS code. See RcppConcaveman.

I'd like to have your opinion of these two points.

  1. Do you have an idea where the two implementations diverge?
  2. Do you have an idea where your implementation can be speed-up?

Thank you

@sadaszewski
Copy link
Owner

sadaszewski commented Mar 18, 2020 via email

@Jean-Romain
Copy link
Author

I would prioritize the unit tests before looking into performance.

Of course

we could work on this together

My knowledge about JS is limited to few scripts copy/pasted for websites in the early 2000's but yes why not. I started to clean your code. I mean, I put the rtree in a separate file and I re-indented the code in a way I can read it more easily. So I can now go more in depth in the code.

As to the speed-up I had different experience myself, as well as reported by other users, e.g.

So somebody already wrapped your code in a R package. The code is strictly identical to mine but yet I can reproduce the benchmark and the version proposed by this user is 5x faster. I will investigate. It's weird.

@sadaszewski
Copy link
Owner

sadaszewski commented Mar 18, 2020 via email

@Jean-Romain
Copy link
Author

Ok for speed it is my fault. It a mistake I added I my R configuration and g++ was not longer compiling with -02. One question solved.

@Jean-Romain
Copy link
Author

For your information. Your version is 50 times faster when there are very few points (probably because of the overhead introduced by calling JavaScript in R via a V8 wrapper) and tend to be 2 times faster with a lot of points.

timing

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

No branches or pull requests

2 participants