R-core is not the enemy, even when they 'refuse' to do what you want
Improve R without changing the final result of any R code
A contiguous block of memory isn't the best way to store a particular vector
Two main concepts
Easy to guess answer of:
sort(x)when you know
is.na(x)when you know
5 %in% xwhen you know
x < 5when you know
Lets be real for a second - how many numbers do we need before we know everything about n:m?
Quick, ask a 3rd grader: what's the sum of three 5s, two 7s, and three more 5s?
Strings are expensive compared to numeric values. Only make the ones you need.
(this makes default rownames for big data.frames fast)
Do I really need two copies of x to know what
R_NilValueor the vector expanded to traditional form
Length- Self explanatory
Dataptr- "Escape valve" if R internals really need a pointer
Elt- retrieve value of element i without using dataptr
Set_elt- Set the value of element i without using dataptr
Sort_check- Perform (and memoise) check for sortedness
Inspect- info to display when inspect internal is called
Is_sorted- immediately return known sortedness info
No_NA- immediately return known "no NAs" info
Defaults make use of sortedness and no NA info