[#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!

Re: [ ruby-Bugs-2131 ] ruby ( v183) bcc32: using Socket.new with timeout -> files not closed

From: "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
Date: 2005-07-25 02:00:27 UTC
List: ruby-core #5514
Hi.

>That result was INCORRECT.
>  (ISP maintenance when I ran that script yesterday)
>Sorry for the confusion.
>
>This is the result after the win32 'setmode' patch:
>
>["Net::HTTP", "1.126", "1.1"]
>D:/RUBY/SRC_CVSINST/lib/ruby/1.9/net/protocol.rb:70:in `close': Bad file number (Errno::EBADF)

Sorry, setmode() accepted only text mode flags (O_TEXT, O_BINARY). That magic number
was simply ignored.

I installed win98 onto another HDD and tried by myself. Yes, definitly fails with
EBADF. (This is not ZoneAlarm's fault)

I needed this patch to compile ruby-bccwin32 on win98.
"copy" => "xcopy" is needed because "copy" cannot handle the path terminated with \.
I don't know how to remove it, so I used xcopy instead.

Index: bcc32/Makefile.sub
===================================================================
RCS file: /src/ruby/bcc32/Makefile.sub,v
retrieving revision 1.79
diff -u -w -b -p -r1.79 Makefile.sub
--- bcc32/Makefile.sub	1 Jun 2005 02:35:35 -0000	1.79
+++ bcc32/Makefile.sub	24 Jul 2005 11:35:04 -0000
@@ -285,7 +285,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)bcc32/M
 \#define RUBY_ARCHLIB "/lib/ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
 \#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/$(MAJOR).$(MINOR)/$(ARCH)-$(OS)"
 |
-	@exit > $@
+	@exit > $(@:/=\)
 
 config.status: $(MKFILES) $(srcdir)bcc32/Makefile.sub $(srcdir)common.mk
 	@echo Creating $@
@@ -340,8 +340,8 @@ s,@AR@,$(AR),;t t
 s,@ARFLAGS@,$(ARFLAGS) ,;t t
 s,@LN_S@,$(LN_S),;t t
 s,@SET_MAKE@,$(SET_MAKE),;t t
-s,@CP@,copy > nul,;t t
-s,@INSTALL@,copy > nul,;t t
+s,@CP@,xcopy > nul,;t t
+s,@INSTALL@,xcopy > nul,;t t
 s,@INSTALL_PROG@,$$(INSTALL),;t t
 s,@INSTALL_DATA@,$$(INSTALL),;t t
 s,@LIBOBJS@, acosh.obj crypt.obj erf.obj win32.obj,;t t


And another patch. By this patch, your sample code worked fine.

# _close calls CloseHandle for socket, and closesocket is called after the call.
# We should not close the handle twice anyway.

But MSDN says the socket handle socket() and WSASocket() opens must be
closed by corresponding closesocket(), they are not refering to CloseHandle().

# If so, I think it's not good to call _open_osfhandle for socket
# from the begining.

Index: win32/win32.c
===================================================================
RCS file: /src/ruby/win32/win32.c,v
retrieving revision 1.160
diff -u -w -b -p -r1.160 win32.c
--- win32/win32.c	16 Jul 2005 06:59:05 -0000	1.160
+++ win32/win32.c	24 Jul 2005 14:02:18 -0000
@@ -3504,6 +3504,9 @@ rb_w32_fclose(FILE *fp)
 	UnlockFile((HANDLE)sock, 0, 0, LK_LEN, LK_LEN);
 	return fclose(fp);
     }
+#ifdef __BORLANDC__
+    return fclose(fp); /* ouch! CloseHandle for socket */
+#else
     _set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE);
     fclose(fp);
     if (closesocket(sock) == SOCKET_ERROR) {
@@ -3511,6 +3514,7 @@ rb_w32_fclose(FILE *fp)
 	return -1;
     }
     return 0;
+#endif
 }
 
 int
@@ -3522,6 +3526,9 @@ rb_w32_close(int fd)
 	UnlockFile((HANDLE)sock, 0, 0, LK_LEN, LK_LEN);
 	return _close(fd);
     }
+#ifdef __BORLANDC__
+    return _close(fd); /* ouch! CloseHandle for socket */
+#else
     _set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE);
     _close(fd);
     if (closesocket(sock) == SOCKET_ERROR) {
@@ -3529,6 +3536,7 @@ rb_w32_close(int fd)
 	return -1;
     }
     return 0;
+#endif
 }
 
 static int


In This Thread