Re: [Rd] Objectsize function visiting every element for alt-rep strings

2019-01-23 Thread Travers Ching
It should be possible to calculate object.size in the presence of sharing, at least with respect to all sub-nodes of a SEXP. E.g., during calculation, keep a hash of all SEXP pointers visited. If a pointer has already been visited, add only the size of the pointer to the total object size. Trave

Re: [Rd] Objectsize function visiting every element for alt-rep strings

2019-01-23 Thread Tomas Kalibera
On 1/22/19 6:17 PM, Kevin Ushey wrote: I think that object.size() is most commonly used to answer the question, "what R objects are consuming the most memory currently in my R session?" and for that reason I think returning the size of the internal representations of objects (for e.g. ALTREP obje

Re: [Rd] Objectsize function visiting every element for alt-rep strings

2019-01-22 Thread Kevin Ushey
I think that object.size() is most commonly used to answer the question, "what R objects are consuming the most memory currently in my R session?" and for that reason I think returning the size of the internal representations of objects (for e.g. ALTREP objects; unevaluated promises) is the right d

Re: [Rd] Objectsize function visiting every element for alt-rep strings

2019-01-22 Thread Tierney, Luke
On Mon, 21 Jan 2019, Martin Maechler wrote: >> Travers Ching >> on Tue, 15 Jan 2019 12:50:45 -0800 writes: > >> I have a toy alt-rep string package that generates >> randomly seeded strings. example: library(altstringisode) >> x <- altrandomStrings(1e8) head(x) [1] >>

Re: [Rd] Objectsize function visiting every element for alt-rep strings

2019-01-21 Thread Martin Maechler
> Travers Ching > on Tue, 15 Jan 2019 12:50:45 -0800 writes: > I have a toy alt-rep string package that generates > randomly seeded strings. example: library(altstringisode) > x <- altrandomStrings(1e8) head(x) [1] > "2PN0bdwPY7CA8M06zVKEkhHgZVgtV1" > "5PN2qmWqBlQ

Re: [Rd] Objectsize function visiting every element for alt-rep strings

2019-01-19 Thread Travers Ching
Thanks for the detailed response, Gabriel! I think that an object_size alt-rep method that package developers need to implement might be hard to get right. One alternative could be an alt-rep method that returns the number of bytes/characters in a given string element since I believe the object s

Re: [Rd] Objectsize function visiting every element for alt-rep strings

2019-01-18 Thread Gabriel Becker
Travers, Great to hear you're trying out the ALTREP stuff, good on you :). Did you mean the get_altstring_Elt_method? I see the code in size.c within utils that grabs each element, but I don't see any setting (and the setters are noops currently anyway they just do things the old way). One thing

[Rd] Objectsize function visiting every element for alt-rep strings

2019-01-16 Thread Travers Ching
I have a toy alt-rep string package that generates randomly seeded strings. example: library(altstringisode) x <- altrandomStrings(1e8) head(x) [1] "2PN0bdwPY7CA8M06zVKEkhHgZVgtV1" "5PN2qmWqBlQ9wQj99nsQzldVI5ZuGX" ... etc object.size(1e8) Object.size will call the set_altstring_Elt_method for eve