Rcpp11 / rjournal_article

C++11 Article for the R journal
1 stars 0 forks source link

Ideas: variadic templates #9

Open kevinushey opened 10 years ago

kevinushey commented 10 years ago

A brief discussion of the removal of code bloat and how e.g. the Vector::create methods became quite trivial to implement. It might be worth comparing to methods in R that take a variable number of arguments (eg c, rbind, sum, ...)

romainfrancois commented 10 years ago

Eliminating the code bloat and replacing with variadic templates was awesome. We need to quantify the difference, but it is quite huge.

Using variadc templates is not something i anticipate regular users to do, but this can contribute to the section that introduces Rcpp11.

kevinushey commented 10 years ago

For some hard numbers, I count 31,428 lines of code in the inst/include directory of Rcpp11, while there are 92,726 total lines of code in inst/include for Rcpp (latest git revision on master for each). So it looks like Rcpp11 is literally a third of the size, and I imagine most of that is due to the removal of code bloat.

(Counted with a simple find . -name "*.h" | xargs wc -l.)

romainfrancois commented 10 years ago

That's about what I had in mind, but :

So maybe that should be a per feature count. e.g. for:

kevinushey commented 10 years ago

Here's a gist counting the number of lines per feature in Rcpp, Rcpp11.

Feature counts are done by grepping through file paths for the associated feature name (so e.g. everything in a module directory is counted as part of the module feature. Could be made better but this is a nice place to start)

Also, we see that 59k lines of generated code is completely gone in Rcpp11.

Could be easily extended to look at other features of interest.

romainfrancois commented 10 years ago

Nice.

romainfrancois commented 10 years ago

@kevinushey I added you as a collab to this repo in case you want to put your script somewhere in the repo and do some edits.

kevinushey commented 10 years ago

Awesome, thanks! I'll add it soon.