Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Experiment with vendoring cpp11 #188

Closed
chainsawriot opened this issue May 25, 2024 · 2 comments
Closed

Experiment with vendoring cpp11 #188

chainsawriot opened this issue May 25, 2024 · 2 comments
Labels

Comments

@chainsawriot
Copy link
Collaborator

At least for now, it sounds like a decent idea to try and see the potential performance change.

ref

@chainsawriot
Copy link
Collaborator Author

The experience of submitting minty to CRAN is still troubling me.

@chainsawriot
Copy link
Collaborator Author

We do not grow any cpp11 vector at all, so we should expect no performance impact.

cpp11::writable::strings cell_values(out_width*out_length + 2);
cell_values[0] = std::to_string(out_width);
cell_values[1] = std::to_string(out_length);
int t = 2;
for (unsigned int i = 0; i < contents.size(); i++){
for (unsigned int j = 0; j < contents[i].size(); j++){
cell_values[t] = (contents[i][j] != 0) ?
Rf_mkCharCE(parse_single_cell(contents[i][j], formula_as_formula, true).c_str(), CE_UTF8) : NA_STRING;
t++;
}
// Pad rows to even width
if(contents[i].size() < out_width){
unsigned int row_width = contents[i].size();
for (unsigned int j = 0; j + row_width < out_width; j++){
cell_values[t] = "";
t++;
}
}
}
return cell_values;
}

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

No branches or pull requests

1 participant