Re: [v8-users] String to Socket

2010-04-23 Thread Stephan Beal
On Fri, Apr 23, 2010 at 11:20 AM, Anton Muhin wrote: > what do you mean by key? > > Technically resource has data virtual method and theoretically data > could be generated on each invocation of the method (but that must be > the same data). So, yes, you could lookup data from some table if it'

Re: [v8-users] String to Socket

2010-04-23 Thread Anton Muhin
Stephan, what do you mean by key? Technically resource has data virtual method and theoretically data could be generated on each invocation of the method (but that must be the same data). So, yes, you could lookup data from some table if it's fine for you performance-wise. yours, anton. On Fri

Re: [v8-users] String to Socket

2010-04-23 Thread Stephan Beal
On Thu, Apr 22, 2010 at 8:36 PM, Ryan Dahl wrote: > Maybe, but that doesn't solve the problem of associating encoded data > with a string instance so that the next time the string is written to > socket the encoded data is easily accessible. The benchmark I'm > interested in fixing is the case wh

Re: [v8-users] String to Socket

2010-04-22 Thread Anton Muhin
Sorry, I am probably missing something. Let me describe how I understand your problem: you've got V8 string which you'd like to write utf8 encoded into socket several times and you don't want to pay for conversion. Given that strings are immutable you can do the following: First time you write

Re: [v8-users] String to Socket

2010-04-22 Thread Ryan Dahl
On Thu, Apr 22, 2010 at 10:18 AM, Anton Muhin wrote: > On Thu, Apr 22, 2010 at 9:05 PM, Ryan Dahl wrote: >> On Thu, Apr 22, 2010 at 12:19 AM, Anton Muhin wrote: >>> Ryan, >>> >>> just a quick question: couldn't external strings solve the problem for >>> you?  They sound pretty much like Buffer y

Re: [v8-users] String to Socket

2010-04-22 Thread Anton Muhin
On Thu, Apr 22, 2010 at 9:05 PM, Ryan Dahl wrote: > On Thu, Apr 22, 2010 at 12:19 AM, Anton Muhin wrote: >> Ryan, >> >> just a quick question: couldn't external strings solve the problem for >> you?  They sound pretty much like Buffer you describe as far as I can >> judge from your email. >> >> y

Re: [v8-users] String to Socket

2010-04-22 Thread Ryan Dahl
On Thu, Apr 22, 2010 at 12:19 AM, Anton Muhin wrote: > Ryan, > > just a quick question: couldn't external strings solve the problem for > you?  They sound pretty much like Buffer you describe as far as I can > judge from your email. > > yours, > anton. I hadn't considered using external strings b

Re: [v8-users] String to Socket

2010-04-22 Thread Anton Muhin
Ryan, just a quick question: couldn't external strings solve the problem for you? They sound pretty much like Buffer you describe as far as I can judge from your email. yours, anton. On Thu, Apr 22, 2010 at 3:03 AM, wrote: > I'm experiencing a bottleneck in my application, Node, when writing

Re: [v8-users] String to Socket

2010-04-21 Thread Stephan Beal
On Thu, Apr 22, 2010 at 1:03 AM, wrote: > ssize_t String::SocketWriteUtf8 (int fd, size_t offset); > That's a very nice idea, but i would recommend that the interface look something like: typedef ssize_t (*StringWriterCallback)( void const * src, size_t len, void * userData ); ssize_t String:

[v8-users] String to Socket

2010-04-21 Thread ry
I'm experiencing a bottleneck in my application, Node, when writing strings to socket. Here is a benchmark where I create a web server and write a string of X bytes as a response. Compared to other systems which can do write() directly from the string buffer to file descriptor, Node is quite slow: