I had the impression that the data method in the resource may return different pointers, as long as the string content is the same. But in the case Vitaly described, it would indeed be easier and better to just cache the string pointer. How/when are external strings disposed? Would it be possible to replace the resource field by the string pointer after the first call of resource()->data(), destruct the resource object since we dont need it anymore, and change the map to indicate this?
Yang On Nov 15, 2011, at 20:12, "[email protected]" <[email protected]> wrote: > My immediate thought would be the same: If we have a word to spare in the > String > structure, we might as well let it point directly to the real character data > instead of pointing to an intermediate buffer. > It might require tweaking of GC, since it would be a native pointer, but so is > the resource pointer, so it should be doable. > > We were considering adding such a pointer recently, but the overhead of adding > an extra pointer to all external strings seemed steep. It's a good idea to > only > do it to some strings. > > > > http://codereview.chromium.org/8568013/ -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
