This is for all the committers out there.

While working on my latest Buffers PR, noticed there are 
undocumented/unenforced ways things can go wrong. Say, for example, a user 
wants to extend Buffer with their own set of methods/properties and just 
happen to name one of them 'parent' or 'offset'. imho The least I would 
like to see them mentioned in the docs, and possibly underscored.

The following are more complex changes I would like to implement, but 
really need feedback whether they'd be accepted or not:

I noticed that every Buffer() call has to reach out to C. Either to create 
a new SlowBuffer or FastBuffer. Because of this, there are optimizations 
that cannot be performed by the v8 compiler. Even calls to 'this.parent.*' 
can't be optimized well since they require a 'context change' (which could 
be helped by placing the calls directly on the Buffer instance). For these 
and stability reasons (ability to internally manage 'offset's and the like) 
I propose that the memory allocation and management of Slow/Fast Buffers be 
moved to C land.

The basics right now would be to:
- Internally track memory pointers for FastBuffers.
- 'parent' would no longer exists in userland.
- Key user facing properties (e.g. length) are made read-only.

There would be no changes to the documented API. Just, hopefully, making 
Buffers a little quicker and more predictable.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to