From 4cd5fa452a3a070a52636e2a5677f5e996896646 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Fri, 8 Jul 2005 22:35:08 +0000 Subject: [PATCH] Clear the stream after serializing it in Object#to_eet. This slightly increases performance. --- ChangeLog | 6 +++++- ext/ext.c | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa269dc..138496f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,11 @@ -- -$Id: ChangeLog 68 2005-06-29 16:50:47Z tilman $ +$Id: ChangeLog 69 2005-07-08 22:35:08Z tilman $ ++ +2005-07-09 Tilman Sauerbeck (tilman at code-monkey de) + * ext/ext.c: Object#to_eet: clear the stream after serializing it, + which slightly increases performance + 2005-06-29 Tilman Sauerbeck (tilman at code-monkey de) * ext/ext.c: Store the result of rb_intern("pack") in a global variable diff --git a/ext/ext.c b/ext/ext.c index 12b8500..8ba3d5c 100644 --- a/ext/ext.c +++ b/ext/ext.c @@ -1,5 +1,5 @@ /* - * $Id: ext.c 68 2005-06-29 16:50:47Z tilman $ + * $Id: ext.c 69 2005-07-08 22:35:08Z tilman $ * * Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de) * @@ -598,6 +598,9 @@ c_to_eet (VALUE self) args[0] = name; args[1] = rb_funcall (stream, id_serialize, 0); + + rb_ary_clear (stream); /* give the GC a hand... */ + chunk = rb_class_new_instance (2, args, cChunk); return rb_funcall (chunk, id_serialize, 0); -- 2.30.2