unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* threadsafe format.scm
@ 2003-07-29  3:27 Clinton Ebadi
  2003-07-30 22:36 ` Kevin Ryde
  0 siblings, 1 reply; 8+ messages in thread
From: Clinton Ebadi @ 2003-07-29  3:27 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

I wrapped all of the global variables that are modified in format.scm in 
fluids and a quick test makes it appear that the new format is now threadsafe 
(the old one fails, but the new one works). 

The patch is against CVS HEAD, but it works fine with Guile 1.6.4 if the 
:replace is removed. If the patch is correct (I think it is), I don't have 
any copyright assignment papers on file with the FSF so I'd need to sign 
those.
-- 
http://unknownlamer.org
AIM:unknownlamer IRC:unknown_lamer@freenode#hprog

[-- Attachment #2: format.scm.diff.bz2 --]
[-- Type: application/x-bzip2, Size: 6323 bytes --]

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: threadsafe format.scm
  2003-07-29  3:27 threadsafe format.scm Clinton Ebadi
@ 2003-07-30 22:36 ` Kevin Ryde
  2003-07-30 23:06   ` Clinton Ebadi
  0 siblings, 1 reply; 8+ messages in thread
From: Kevin Ryde @ 2003-07-30 22:36 UTC (permalink / raw)
  Cc: guile-devel

Clinton Ebadi <clinton@unknownlamer.org> writes:
>
> I wrapped all of the global variables that are modified in format.scm in 
> fluids and a quick test makes it appear that the new format is now threadsafe 
> (the old one fails, but the new one works). 

Can they be made into local variables within a big define instead (let
or whatever)?  That'd have the advantage of being reentrant too.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: threadsafe format.scm
  2003-07-30 22:36 ` Kevin Ryde
@ 2003-07-30 23:06   ` Clinton Ebadi
  2003-07-31  2:46     ` Clinton Ebadi
  0 siblings, 1 reply; 8+ messages in thread
From: Clinton Ebadi @ 2003-07-30 23:06 UTC (permalink / raw)


On Wednesday 30 July 2003 18:36, Kevin Ryde wrote:
> Clinton Ebadi <clinton@unknownlamer.org> writes:
> > I wrapped all of the global variables that are modified in format.scm in
> > fluids and a quick test makes it appear that the new format is now
> > threadsafe (the old one fails, but the new one works).
>
> Can they be made into local variables within a big define instead (let
> or whatever)?  That'd have the advantage of being reentrant too.

No, because they are shared between all of the many different procedures of 
format. Of course, one could make all of the various procedures used by 
format be local to format. That seems to be the best way to do things, so 
I'll redo my patch so it does that instead. I also noticed (a few minutes 
ago) that I missed the variables used by the floating point printer that are 
global and modified.

-- 
http://unknownlamer.org
AIM:unknownlamer IRC:unknown_lamer@freenode#hprog


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: threadsafe format.scm
  2003-07-30 23:06   ` Clinton Ebadi
@ 2003-07-31  2:46     ` Clinton Ebadi
  2003-07-31 22:11       ` Kevin Ryde
  2003-09-15 13:33       ` Marius Vollmer
  0 siblings, 2 replies; 8+ messages in thread
From: Clinton Ebadi @ 2003-07-31  2:46 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 484 bytes --]

I moved all of the global definitions into a new format procedure that has a 
really long letrec. This should be entirely threadsafe. I'm not sure how 
Guile does evaluation of procedures once they have been evaluated once, so 
I'm not entirely sure if this has a huge amount of overhead or not. The diff 
was quite a bit larger than the source itself, so I decided to include 
format.scm itself instead.

-- 
http://unknownlamer.org
AIM:unknownlamer IRC:unknown_lamer@freenode#hprog

[-- Attachment #2: format.scm.bz2 --]
[-- Type: application/x-bzip2, Size: 12695 bytes --]

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: threadsafe format.scm
  2003-07-31  2:46     ` Clinton Ebadi
@ 2003-07-31 22:11       ` Kevin Ryde
  2003-08-01  2:39         ` Clinton Ebadi
  2003-09-15 13:33       ` Marius Vollmer
  1 sibling, 1 reply; 8+ messages in thread
From: Kevin Ryde @ 2003-07-31 22:11 UTC (permalink / raw)
  Cc: guile-devel

Clinton Ebadi <clinton@unknownlamer.org> writes:
>
> I moved all of the global definitions into a new format procedure that has a 
> really long letrec.

format:version looks like it's a constant, so wouldn't need to be in
there.

> so I'm not entirely sure if this has a huge amount of overhead or
> not.

If you want to look at efficiency, changing the error continuation to
a catch/throw would probably help.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: threadsafe format.scm
  2003-07-31 22:11       ` Kevin Ryde
@ 2003-08-01  2:39         ` Clinton Ebadi
  2003-08-01  3:18           ` Clinton Ebadi
  0 siblings, 1 reply; 8+ messages in thread
From: Clinton Ebadi @ 2003-08-01  2:39 UTC (permalink / raw)
  Cc: guile-devel

On Thursday 31 July 2003 18:11, Kevin Ryde wrote:
> Clinton Ebadi <clinton@unknownlamer.org> writes:
> > I moved all of the global definitions into a new format procedure that
> > has a really long letrec.
>
> format:version looks like it's a constant, so wouldn't need to be in
> there.

Right, but I just did a quick wrapping of everything inside of one huge 
procedure so nothing was global anymore. I don't know if there is really any 
point to making format:version be bound outside of the procedure because 
nothing outside of the new format uses it.

> > so I'm not entirely sure if this has a huge amount of overhead or
> > not.
>
> If you want to look at efficiency, changing the error continuation to
> a catch/throw would probably help.

Right, this code existed before Guile did. I was really wondering if having 
the long letrec would cause any overhead problems (e.g. if it were evaluated 
and everything inside of it rebound upon each call instead of once when the 
module was loaded). But I'm not sure how Guile handles form like letrec so I 
don't know if the procedure now has unacceptable overhead. 

I'll rework the error-continuation and send a third revision of the patch, but 
I'd like to know if anyone has used the new format and found their programs 
to run slower.

-- 
http://unknownlamer.org
AIM:unknownlamer IRC:unknown_lamer@freenode#hprog


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: threadsafe format.scm
  2003-08-01  2:39         ` Clinton Ebadi
@ 2003-08-01  3:18           ` Clinton Ebadi
  0 siblings, 0 replies; 8+ messages in thread
From: Clinton Ebadi @ 2003-08-01  3:18 UTC (permalink / raw)


> I'll rework the error-continuation and send a third revision of the patch,
> but I'd like to know if anyone has used the new format and found their
> programs to run slower.

Actually, format:error-continuation isn't used anymore so any references to it 
can simply be removed.
-- 
http://unknownlamer.org
AIM:unknownlamer IRC:unknown_lamer@freenode#hprog


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: threadsafe format.scm
  2003-07-31  2:46     ` Clinton Ebadi
  2003-07-31 22:11       ` Kevin Ryde
@ 2003-09-15 13:33       ` Marius Vollmer
  1 sibling, 0 replies; 8+ messages in thread
From: Marius Vollmer @ 2003-09-15 13:33 UTC (permalink / raw)
  Cc: guile-devel

Clinton Ebadi <clinton@unknownlamer.org> writes:

> I moved all of the global definitions into a new format procedure that has a 
> really long letrec. This should be entirely threadsafe.

Great, thanks!  I have installed this.  We don't need papers for it
since the change itself, although affecting everything, is quite
small.

> I'm not sure how Guile does evaluation of procedures once they have
> been evaluated once, so I'm not entirely sure if this has a huge
> amount of overhead or not.

There shouldn't be too much overhead.  It will be slower than with
globals (probably, I would have to benchmark it to be sure), but not
much.  However, the letrec _is_ pretty big and environment access in
Guile is O(n), so well...

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-09-15 13:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-29  3:27 threadsafe format.scm Clinton Ebadi
2003-07-30 22:36 ` Kevin Ryde
2003-07-30 23:06   ` Clinton Ebadi
2003-07-31  2:46     ` Clinton Ebadi
2003-07-31 22:11       ` Kevin Ryde
2003-08-01  2:39         ` Clinton Ebadi
2003-08-01  3:18           ` Clinton Ebadi
2003-09-15 13:33       ` Marius Vollmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).