Re: [PATCH] Add internal-only port structure; move iconv descriptors there

2013-04-01 Thread Andy Wingo
On Mon 01 Apr 2013 22:54, Andy Wingo writes: > Though we already violate them in innumerable ways in Guile, this is not > one of those cases: > > struct foo { a a; b b; } *foo; > foo = malloc (sizeof (*foo)); > a* a = &bar.a; > b* b = &bar.b; To be clear, I was suggesting to allocate som

Re: [PATCH] Add internal-only port structure; move iconv descriptors there

2013-04-01 Thread Andy Wingo
On Mon 01 Apr 2013 22:03, Mark H Weaver writes: >>>SCM z = scm_cons (SCM_EOL, SCM_EOL); >>> - scm_t_port *entry = (scm_t_port *) scm_gc_calloc (sizeof (scm_t_port), >>> "port"); >>> + scm_t_port *entry = scm_gc_typed_calloc (scm_t_port); >>> + scm_t_port_internal *pti = scm_gc_typed_callo

Re: [PATCH] Add internal-only port structure; move iconv descriptors there

2013-04-01 Thread Mark H Weaver
Hi Andy, Andy Wingo writes: > LGTM if these are addressed: > > On Sun 31 Mar 2013 09:52, Mark H Weaver writes: > >> +#define SCM_INTERNAL_PTAB_ENTRY(x) \ >> + ((scm_t_port_internal *) (SCM_PTAB_ENTRY(x)->input_cd)) >> + > > SCM_PORT_GET_INTERNAL(x) ? PTAB is a his

Re: [PATCH] Optimize 'get-bytevector-some'; it may now read less than possible

2013-04-01 Thread Andy Wingo
On Mon 01 Apr 2013 03:32, Mark H Weaver writes: > This patch changes it to simply fill the read buffer (if empty) and then > copy the contents of the read/putback buffers into a bytevector that is > never resized. LGTM; but the docs are a little confusing: -- Scheme Procedure: get-bytevector-s

Re: [PATCH] Add inspection command "source (, src)" which shows Scheme code of loaded module

2013-04-01 Thread Andy Wingo
On Sat 30 Mar 2013 22:17, Mark H Weaver writes: > I'd be glad to see something like this in Guile core. This code is a > great demonstration, but it has some problems. It would be nice to reify the original source as a compressed string in the debug section of the ELF file. One day... Andy --

Re: Whats' the proper senario of par-map? (Was Re: bug#13188: par-map causes VM stack overflow)

2013-04-01 Thread Andy Wingo
On Fri 29 Mar 2013 06:49, Mark H Weaver writes: >> scheme@(guile-user)> ,time (define a (map (lambda (x) (expt x 5)) (iota >> 1))) >> ;; 0.008019s real time, 0.007979s run time. 0.00s spent in GC. >> scheme@(guile-user)> ,time (define a (par-map (lambda (x) (expt x 5)) >> (iota 1)))

Re: [PATCH] Add private port structure, and move iconv descriptors there

2013-04-01 Thread Andy Wingo
On Sun 31 Mar 2013 21:44, Mark H Weaver writes: > + { > +GC_finalization_proc prev_finalizer; > +GC_PTR prev_finalization_data; > + > +/* Register a finalizer to close the descriptors. */ > +GC_REGISTER_FINALIZER_NO_ORDER (id, finalize_iconv_descriptors, 0, > +

Re: [PATCH] Add internal-only port structure; move iconv descriptors there

2013-04-01 Thread Andy Wingo
LGTM if these are addressed: On Sun 31 Mar 2013 09:52, Mark H Weaver writes: > +#define SCM_INTERNAL_PTAB_ENTRY(x) \ > + ((scm_t_port_internal *) (SCM_PTAB_ENTRY(x)->input_cd)) > + SCM_PORT_GET_INTERNAL(x) ? PTAB is a historical name (port table; there is no more

array-copy! is slow & array-map.c (was: Extremly slow for format & string-join)

2013-04-01 Thread Daniel Llorens
> Message: 5 > Date: Mon, 1 Apr 2013 15:40:48 +0800 > From: Daniel Hartwig > To: guile-devel@gnu.org > Subject: Re: Extremly slow for format & string-join > On 1 April 2013 14:59, Daniel Llorens wrote: >> How can it be slower to allocate the result at once? > > Shrug. I do not know much of a

Re: Extremly slow for format & string-join

2013-04-01 Thread Ian Price
Nala Ginrut writes: > string-join is a common thing for text processing(include web develop). > However, our powerful 'format' is not so efficient. I do think it's > necessary to we spend some time on it. As Mark says, format is a not very nice piece of code to read, or to modify, so if you want

Re: Extremly slow for format & string-join

2013-04-01 Thread Thien-Thi Nguyen
() Nala Ginrut () Mon, 01 Apr 2013 12:00:01 +0800 (define (str* str n) (format #f "~{~a~}" (make-list n str))) (define (str* str n) (string-join (make-list n str) "")) Here's another implementation, using SRFI 13 ‘xsubstring’: (define (str* str n) (xsubstring str 0 (* n (stri

Re: redo-safe-variables and redo-safe-parameters

2013-04-01 Thread Stefan Israelsson Tampe
> Daniel Writed > Dynamic states are not suitable for the purpose. They have nothing to > do with compenstating for the inability of continuations to backtrack > _through side-effects_. I believe this will be obvious if you > consider the problem of side-effects generally, rather than focusing >

Re: Extremly slow for format & string-join

2013-04-01 Thread Nala Ginrut
On Mon, 2013-04-01 at 04:36 -0400, Mark H Weaver wrote: > Nala Ginrut writes: > > > I've tried to implement a function to mimic string multiply like Python: > > "asdf" * 10 > > > > --code > > (define (str* str n) > > (format #f "~{~a~}" (make-list n str))) > > > > or

Re: Extremly slow for format & string-join

2013-04-01 Thread Mark H Weaver
Nala Ginrut writes: > I've tried to implement a function to mimic string multiply like Python: > "asdf" * 10 > > --code > (define (str* str n) > (format #f "~{~a~}" (make-list n str))) > > or > > (define (str* str n) > (string-join (make-list n str) "")) >

Re: Extremly slow for format & string-join

2013-04-01 Thread Daniel Hartwig
On 1 April 2013 14:59, Daniel Llorens wrote: > > Hello, > >> From: Daniel Hartwig >> >> (define (str* str n) >> (call-with-output-string >>(lambda (p) >> (let lp ((n n)) >>(unless (zero? n) >> (display str p) >> (lp (1- n))) >> >> Out of curiousity, how doe

Re: Extremly slow for format & string-join

2013-04-01 Thread Daniel Hartwig
On 1 April 2013 14:58, Nala Ginrut wrote: > On Mon, 2013-04-01 at 13:35 +0800, Daniel Hartwig wrote: >> 2013/4/1 Nala Ginrut : >> > Anyway, string-join is so slowly beyond my expectation. >> >> Also note that ‘string-concatenate’ (less general than ‘string-join’) >> performs better for the same ca

Re: Extremly slow for format & string-join

2013-04-01 Thread Daniel Llorens
Hello, > From: Daniel Hartwig > > 2013/4/1 Nala Ginrut : >> I've tried to implement a function to mimic string multiply like Python: >> "asdf" * 10 >> >> --code >> (define (str* str n) >> (format #f "~{~a~}" (make-list n str))) >> >> or >> >> (define (str* str n)