[#5322] O(1) performance for insertions/deletions at the front of an Array/String — Eric Mahurin <eric_mahurin@...>

I just did some benchmarks on push, pop, shift, and unshift

24 messages 2005/07/01
[#5338] Re: O(1) performance for insertions/deletions at the front of an Array/String — Mathieu Bouchard <matju@...> 2005/07/02

On Fri, 1 Jul 2005, Eric Mahurin wrote:

[#5348] Re: O(1) performance for insertions/deletions at the front of an Array/String — Eric Mahurin <eric_mahurin@...> 2005/07/02

--- Mathieu Bouchard <matju@artengine.ca> wrote:

[#5357] Re: O(1) performance for insertions/deletions at the front of an Array/String — Mathieu Bouchard <matju@...> 2005/07/03

On Sat, 2 Jul 2005, Eric Mahurin wrote:

[#5359] Re: O(1) performance for insertions/deletions at the front of an Array/String — Eric Mahurin <eric_mahurin@...> 2005/07/03

--- Mathieu Bouchard <matju@artengine.ca> wrote:

[#5361] Re: O(1) performance for insertions/deletions at the front of an Array/String — Mathieu Bouchard <matju@...> 2005/07/03

On Sun, 3 Jul 2005, Eric Mahurin wrote:

[#5362] Re: O(1) performance for insertions/deletions at the front of an Array/String — Eric Mahurin <eric_mahurin@...> 2005/07/03

--- Mathieu Bouchard <matju@artengine.ca> wrote:

[#5365] Re: O(1) performance for insertions/deletions at the front of an Array/String — Yukihiro Matsumoto <matz@...> 2005/07/04

Hi,

[#5367] Re: O(1) performance for insertions/deletions at the front of an Array/String — Eric Mahurin <eric_mahurin@...> 2005/07/04

--- Yukihiro Matsumoto <matz@ruby-lang.org> wrote:

[#5368] Re: O(1) performance for insertions/deletions at the front of an Array/String — Yukihiro Matsumoto <matz@...> 2005/07/04

Hi,

[#5372] Re: O(1) performance for insertions/deletions at the front of an Array/String — Florian Gro<florgro@...> 2005/07/04

Yukihiro Matsumoto wrote:

[#5420] Sydney Developer Preview 1 released — Evan Webb <evanwebb@...>

Sydney, an experimental ruby interpreter, has been released!

15 messages 2005/07/11
[#5424] Re: [ANN] Sydney Developer Preview 1 released — Evan Webb <evanwebb@...> 2005/07/12

Thanks everyone for the feedback so far!

Problem with socket communications on Windows

From: "Jim McMaster" <jim.mcmaster@...>
Date: 2005-07-05 21:50:57 UTC
List: ruby-core #5388
I recently installed PGP 9.0 on my Windows XP SP2 machine.  At that point,
all ruby socket communications stopped dead.  Whenever anything in ruby
tries to open a socket, the process hangs until I kill it from the Windows
Task Manager.  Reverting to PGP 8.0 fixed the problem.

I asked about this on the PGP support forum, and got the following response:

------------------------------------------------------------------

Posted: Sun Jun 12, 2005 6:40 am    Post subject: 	
I downloaded Ruby and reproduced exactly what you
describe.

It looks like Ruby has the same problem that older versions
of Perl had with LSPs (the layered service provider method
that PGP and others use to hook into the network
stream). These Unix crossover apps like to use sockets
as filehandles, which current win32 non-IFS LSPs can't
support.

One solution is to modify the application source win32_socket
to look for a winsock2 provider that does support IFS (not just
the default one you find) as Perl has already done:

http://groups-beta.google.com/group/perl.perl5.changes/browse_thread/thread/
88c55d0a3617d307/8d08c536c9fde57b?q=%2Bperl+%2BLSP+%2BIFS&rnum=1&hl=en#8d08c
536c9fde57b

I noticed that the ruby source code is based on a variant of the
same Intergraph win32 socket source file, so it should be easy to
modify rb_w32_socket in much the same way.

http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/win32/win32.c?rev=1.103.2.2
7;content-type=text%2Fplain

The preferable solution of course is to support IFS in the
LSP directly. But Microsoft has not released information
about doing this on MSDN just yet. They have already
released it at a developer conference however:

https://www.dynamicevents.com/WFPD.asp

In the meantime, I may try to submit a Perl-like patch
to the Ruby developers.
-------------------------------------------------------------------------


Sometime later, the same person posted the following patch:

-------------------------------------------------------------------------
	
Posted: Mon Jun 13, 2005 5:27 pm    Post subject: 	

I checked out the ruby1.9 source tree and modified win32.c
with a Perl-like fix. GEM/rails did not like ruby1.9 at all
(worked fine with ruby 1.8) so I could not verify that
gem install rails now works, but I did confirm that this
change got the right provider with a simple ruby TCPsocket
test. That is not a definitive test, but this is the first time I've
worked with ruby. Let me know if this works better for you
(or you can forward it on to the ruby team for their
perusal).

Thanks
Bill

Index: win32/win32.c
===================================================================
RCS file: /src/ruby/win32/win32.c,v
retrieving revision 1.153
diff -r1.153 win32.c
2003c2003
< iSockOpt = SO_SYNCHRONOUS_NONALERT;
---
> // iSockOpt = SO_SYNCHRONOUS_NONALERT;
2011,2012c2011,2012
< setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
< (char *)&iSockOpt, sizeof(iSockOpt));
---
> // setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
> // (char *)&iSockOpt, sizeof(iSockOpt));
2278a2279,2329
> SOCKET
> open_ifs_socket(int af, int type, int protocol)
> {
> char *s;
> unsigned long proto_buffers_len = 0;
> int error_code;
> SOCKET out = INVALID_SOCKET;
>
> // MessageBox(NULL,"open_ifs_socket","DEBUG",MB_OK);
>
> if (WSAEnumProtocolsA(NULL, NULL, &proto_buffers_len) == SOCKET_ERROR)
> {
> error_code=WSAGetLastError();
>
> if(error_code == WSAENOBUFS)
> {
> WSAPROTOCOL_INFOA *proto_buffers;
> int protocols_available = 0;
>
> proto_buffers=(WSAPROTOCOL_INFOA *)malloc(proto_buffers_len);
>
> if ((protocols_available = WSAEnumProtocolsA(NULL,proto_buffers,
> &proto_buffers_len)) != SOCKET_ERROR)
> {
> int i;
> for (i = 0; i < protocols_available; i++)
> {
> WSAPROTOCOL_INFOA proto_info;
>
> if ((af != AF_UNSPEC && af != proto_buffers[i].iAddressFamily)
> || (type != proto_buffers[i].iSocketType)
> || (protocol != 0 && protocol != proto_buffers[i].iProtocol))
> continue;
>
> if ((proto_buffers[i].dwServiceFlags1 & XP1_IFS_HANDLES) == 0)
> continue;
>
> // MessageBox(NULL,proto_buffers[i].szProtocol,"DEBUG",MB_OK);
>
> out = WSASocket(af, type, protocol, &(proto_buffers[i]), 0, 0);
> break;
> }
> }
>
> free(proto_buffers);
> }
> }
>
> return out;
> }
>
2289c2340
< s = socket(af, type, protocol);
---
> s = open_ifs_socket(af, type, protocol);

----------------------------------------------------------------------------
-

I tried posting this to the ruby-talk list, and got no response, other than
a suggestion to post it to ruby-core.  I do not have the tools or expertise
to see if this fixes the problem, but I am submitting it here in the hope
someone here can do so.  I really would like to have this fixed in 1.8 if at
all possible.

Thank you.

-- 
Jim McMaster
mailto:jim.mcmaster@comcast.net



In This Thread

Prev Next