public inbox for guile-gtk@sourceware.org
 help / color / mirror / Atom feed
* Compiling guile-gobject experiences
@ 2003-08-02 17:17 Andreas Rottmann
  2003-08-04 16:25 ` Andy Wingo
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Rottmann @ 2003-08-02 17:17 UTC (permalink / raw)
  To: guile-gtk

Hi!

I've just tried a rebuild of a new guile-gobject CVS checkout. The
build takes extremly long (I've cancelled it, after my machine started
heavy trashing). The problem is the generated guile-gnome-gw-gtk.c,
which has 154075 lines (:-O). 

My machine is not really that low-end: AMD Athlon 900Mhz, 384MB RAM,
over 1G Swap. I used gcc 3.3.1 20030728 (Debian prerelease), default
optimization settings (-O2).

After over 10 minutes of running, needing over 100MB of RAM, consuming
100% CPU, gcc got even more greedy and memory usage got up to ~825MB,
which caused my machine to trash, of course, and CPU consumption fell to
near zero.

In short, the solution would be to break the big C file into several
junks, or reduce the size of the autogenerated code (if that's
feasible at all). For comparison, I had a look at the python GTK
wrappers, and their gtk.c file only (;-)) has 37060 lines, which is
less than 25%...

Regards, Andy
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

It's GNU/Linux dammit!

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

* Re: Compiling guile-gobject experiences
  2003-08-02 17:17 Compiling guile-gobject experiences Andreas Rottmann
@ 2003-08-04 16:25 ` Andy Wingo
  2003-08-04 16:58   ` Andreas Rottmann
  2003-09-12 23:02   ` Kevin Ryde
  0 siblings, 2 replies; 11+ messages in thread
From: Andy Wingo @ 2003-08-04 16:25 UTC (permalink / raw)
  To: guile-gtk

On Sat, 02 Aug 2003, Andreas Rottmann wrote:

> I've just tried a rebuild of a new guile-gobject CVS checkout. The
> build takes extremly long (I've cancelled it, after my machine started
> heavy trashing). The problem is the generated guile-gnome-gw-gtk.c,
> which has 154075 lines (:-O). 

This happens for me too, but only on gcc-3.3. If you try make with
gcc-3.2 (and even better with CC='ccache gcc-3.2'), the problem isn't
near so bad.

And my machine is low-end, these days anyway: a celeron 600 with 192
megs of ram.

But I do agree that it's a problem. I think reducing the size of the
generated code is the best solution, personally.

I'm glad to hear that you're compiling the code :-) I'd be pleased to
have you on as a co-maintainer if you're still interested. My internet
connection is spotty, and I'm about to go on holiday in a couple weeks,
for the record.

Regards,

Andy (another one ;)

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

* Re: Compiling guile-gobject experiences
  2003-08-04 16:25 ` Andy Wingo
@ 2003-08-04 16:58   ` Andreas Rottmann
  2003-08-07  8:09     ` Andy Wingo
  2003-09-12 23:02   ` Kevin Ryde
  1 sibling, 1 reply; 11+ messages in thread
From: Andreas Rottmann @ 2003-08-04 16:58 UTC (permalink / raw)
  To: guile-gtk

Andy Wingo <wingo@pobox.com> writes:

> On Sat, 02 Aug 2003, Andreas Rottmann wrote:
>
>> I've just tried a rebuild of a new guile-gobject CVS checkout. The
>> build takes extremly long (I've cancelled it, after my machine started
>> heavy trashing). The problem is the generated guile-gnome-gw-gtk.c,
>> which has 154075 lines (:-O). 
>
> This happens for me too, but only on gcc-3.3. If you try make with
> gcc-3.2 (and even better with CC='ccache gcc-3.2'), the problem isn't
> near so bad.
>
> And my machine is low-end, these days anyway: a celeron 600 with 192
> megs of ram.
>
> But I do agree that it's a problem. I think reducing the size of the
> generated code is the best solution, personally.
>
> I'm glad to hear that you're compiling the code :-) I'd be pleased to
> have you on as a co-maintainer if you're still interested. My internet
> connection is spotty, and I'm about to go on holiday in a couple weeks,
> for the record.
>
Yes, I'm still interested (and have an ADSL connection :-), at least
until October, when I'll probably move to Vienna).

How should we go on about g-wrap? We really should have a CVS
repository of it, so since Rob Browning isn't responsive, we maybe
should set one up on savannah in the guile-gtk project temporarily[0]?

Regards, Andy

[0] Yes, I know forks are bad, but as a temporary measure...
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Python is executable pseudocode, Perl is executable line-noise.

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

* Re: Compiling guile-gobject experiences
  2003-08-04 16:58   ` Andreas Rottmann
@ 2003-08-07  8:09     ` Andy Wingo
  2003-08-07 11:18       ` Andreas Rottmann
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Wingo @ 2003-08-07  8:09 UTC (permalink / raw)
  To: guile-gtk; +Cc: rlb

On Mon, 04 Aug 2003, Andreas Rottmann wrote:

> Andy Wingo <wingo@pobox.com> writes:
>
> > I'd be pleased to have you on as a co-maintainer if you're still
> > interested.
>
> Yes, I'm still interested (and have an ADSL connection :-), at least
> until October, when I'll probably move to Vienna).

Grand! Do you have cvs access? I think Marius would be the person to ask
to get that...

> How should we go on about g-wrap? We really should have a CVS
> repository of it, so since Rob Browning isn't responsive, we maybe
> should set one up on savannah in the guile-gtk project temporarily[0]?

Hm, I was wondering about that as well, especially with your GError
support... hm. I don't know really, I guess this would be OK as a
temporary measure. The best thing would be somehow to be able to import
it within the g-wrap project that you said was already made, but Rob
would need to be around to authorise that... Dunno. I'm copying him on
this e-mail, hopefully he comes back to life within the next couple of
weeks.

regards,

wingo.

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

* Re: Compiling guile-gobject experiences
  2003-08-07  8:09     ` Andy Wingo
@ 2003-08-07 11:18       ` Andreas Rottmann
  0 siblings, 0 replies; 11+ messages in thread
From: Andreas Rottmann @ 2003-08-07 11:18 UTC (permalink / raw)
  To: guile-gtk; +Cc: rlb

Andy Wingo <wingo@pobox.com> writes:

> On Mon, 04 Aug 2003, Andreas Rottmann wrote:
>
>> Andy Wingo <wingo@pobox.com> writes:
>>
>> > I'd be pleased to have you on as a co-maintainer if you're still
>> > interested.
>>
>> Yes, I'm still interested (and have an ADSL connection :-), at least
>> until October, when I'll probably move to Vienna).
>
> Grand! Do you have cvs access? I think Marius would be the person to ask
> to get that...
>
No, not yet. I'll ask Marius.

>> How should we go on about g-wrap? We really should have a CVS
>> repository of it, so since Rob Browning isn't responsive, we maybe
>> should set one up on savannah in the guile-gtk project temporarily[0]?
>
> Hm, I was wondering about that as well, especially with your GError
> support... hm. I don't know really, I guess this would be OK as a
> temporary measure. The best thing would be somehow to be able to import
> it within the g-wrap project that you said was already made, but Rob
> would need to be around to authorise that... Dunno. I'm copying him on
> this e-mail, hopefully he comes back to life within the next couple of
> weeks.
>
I hope he doesn't hack g-wrap to hard these days, since I'm ATM trying
to make the generated C code smaller (enums are the thing I tackle
right now).

Regards, 
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Packages should build-depend on what they should build-depend.

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

* Re: Compiling guile-gobject experiences
  2003-08-04 16:25 ` Andy Wingo
  2003-08-04 16:58   ` Andreas Rottmann
@ 2003-09-12 23:02   ` Kevin Ryde
  2003-09-13 12:43     ` Marius Vollmer
  2003-09-14 19:47     ` Andreas Rottmann
  1 sibling, 2 replies; 11+ messages in thread
From: Kevin Ryde @ 2003-09-12 23:02 UTC (permalink / raw)
  To: guile-gtk

Andy Wingo <wingo@pobox.com> writes:
>
> But I do agree that it's a problem. I think reducing the size of the
> generated code is the best solution, personally.

A bit less error inlining might help.  I can see how the cleanup stuff
ends up needing it, but there's plenty of cases with no cleanups.
Perhaps building a list of cleanups at runtime would keep it down.

It'd be nice to call foreign functions just based on a little set of
argument types, with no actual individual glue code at all.  I've got
an idea gnu smalltalk has something like that.

I don't think there's any way to portably make a C call from runtime
arguments, in general, but it wouldn't be hard to setup the right
thing for each CPU+ABI, with a bit of assembler.  Or maybe gcc could
help.

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

* Re: Compiling guile-gobject experiences
  2003-09-12 23:02   ` Kevin Ryde
@ 2003-09-13 12:43     ` Marius Vollmer
  2003-09-19  0:19       ` Kevin Ryde
  2003-09-14 19:47     ` Andreas Rottmann
  1 sibling, 1 reply; 11+ messages in thread
From: Marius Vollmer @ 2003-09-13 12:43 UTC (permalink / raw)
  To: guile-gtk

Kevin Ryde <user42@zip.com.au> writes:

> I don't think there's any way to portably make a C call from runtime
> arguments, in general, but it wouldn't be hard to setup the right
> thing for each CPU+ABI, with a bit of assembler.  Or maybe gcc could
> help.

There are already libraries out there for this.  I think "libffi" and
"libffcall" would be the search terms.

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

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

* Re: Compiling guile-gobject experiences
  2003-09-12 23:02   ` Kevin Ryde
  2003-09-13 12:43     ` Marius Vollmer
@ 2003-09-14 19:47     ` Andreas Rottmann
  2003-09-15 17:59       ` GOOPS slowness [was: Compiling guile-gobject experiences] Andreas Rottmann
  2003-09-19  0:18       ` Compiling guile-gobject experiences Kevin Ryde
  1 sibling, 2 replies; 11+ messages in thread
From: Andreas Rottmann @ 2003-09-14 19:47 UTC (permalink / raw)
  To: guile-gtk

Kevin Ryde <user42@zip.com.au> writes:

> Andy Wingo <wingo@pobox.com> writes:
>>
>> But I do agree that it's a problem. I think reducing the size of the
>> generated code is the best solution, personally.
>
> A bit less error inlining might help.  I can see how the cleanup stuff
> ends up needing it, but there's plenty of cases with no cleanups.
> Perhaps building a list of cleanups at runtime would keep it down.
>
I've now made modifications to g-wrap and guile-gobject that make them
use a loop over an array for procedure and method creation,
respectivly. This makes the _init function for large wrapsets
considerably smaller. I'm ATM testing my modifications.

A way to speed the binding creation up a little bit might be to move
the ability to create methods into g-wrap, since that would save us a
few scm_c_lookups for each method. I'll look into this once I'm done
with testing the above mentioned modifictations.

> It'd be nice to call foreign functions just based on a little set of
> argument types, with no actual individual glue code at all.  I've got
> an idea gnu smalltalk has something like that.
>
> I don't think there's any way to portably make a C call from runtime
> arguments, in general, but it wouldn't be hard to setup the right
> thing for each CPU+ABI, with a bit of assembler.  Or maybe gcc could
> help.
>
As Marius already mentioned, there are (at least) two libs that do
this. libffcall seems to be the more featureful one from a first
glance.

Regards, Andy
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Make free software, not war!

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

* GOOPS slowness [was: Compiling guile-gobject experiences]
  2003-09-14 19:47     ` Andreas Rottmann
@ 2003-09-15 17:59       ` Andreas Rottmann
  2003-09-19  0:18       ` Compiling guile-gobject experiences Kevin Ryde
  1 sibling, 0 replies; 11+ messages in thread
From: Andreas Rottmann @ 2003-09-15 17:59 UTC (permalink / raw)
  To: guile-gtk; +Cc: guile-devel

[Cc'ed to guile-devel since this is a guile/GOOPS speed issue;

 Context: The new guile-gobject Guile bindings for GTK+ use GOOPS to
 provide an OO interface. Building this interface (at binding module
 load time) is painfully slow (leading to a 10 seconds total for
 loading the whole GTK+ binding on my machine (Athlon 900)).
]

Andreas Rottmann <a.rottmann@gmx.at> writes:

> A way to speed the binding creation up a little bit might be to move
> the ability to create methods into g-wrap, since that would save us a
> few scm_c_lookups for each method. I'll look into this once I'm done
> with testing the above mentioned modifications.
>
I've now done that and have all code for method creation in one
place. I did some simple benchmarking via clock() and identified the
major culprits:

  method creation : 4.35 seconds total (1350 * 0.00322222)
    GF create: 3.01 seconds total (782 * 0.0038491)
    method add: 1.25 seconds total (1048 * 0.00119275)


The values in the parenthesis are the count how often the code segment
is executed and the time in seconds for each iteration.

"GF create" is the following code:

default_val = scm_make (scm_list_3 (scm_class_generic,
                                    name_keyword, generic_name));

"method add" is this:

scm_add_method (gf, meth);

Now I wonder why it takes so long to construct a generic function (the
method add time is not *that* bad)...

Regards, Andy
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Packages should build-depend on what they should build-depend.

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

* Re: Compiling guile-gobject experiences
  2003-09-14 19:47     ` Andreas Rottmann
  2003-09-15 17:59       ` GOOPS slowness [was: Compiling guile-gobject experiences] Andreas Rottmann
@ 2003-09-19  0:18       ` Kevin Ryde
  1 sibling, 0 replies; 11+ messages in thread
From: Kevin Ryde @ 2003-09-19  0:18 UTC (permalink / raw)
  To: guile-gtk

Andreas Rottmann <a.rottmann@gmx.at> writes:
>
> This makes the _init function for large wrapsets
> considerably smaller.

Oh, I see, it's huge.  I was only nosing around the individual
functions.  I wonder if the poor optimizer in gcc gets bogged down
looking for non-existant common subexpressions or stuff.

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

* Re: Compiling guile-gobject experiences
  2003-09-13 12:43     ` Marius Vollmer
@ 2003-09-19  0:19       ` Kevin Ryde
  0 siblings, 0 replies; 11+ messages in thread
From: Kevin Ryde @ 2003-09-19  0:19 UTC (permalink / raw)
  To: guile-gtk

Marius Vollmer <mvo@zagadka.de> writes:
>
> There are already libraries out there for this.  I think "libffi" and
> "libffcall" would be the search terms.

Looks good.  A wrapped function might be able to be an apply-able smob
with a pointer to the C func and some bits and bytes saying what its
arguments are like.

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

end of thread, other threads:[~2003-09-19  0:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-02 17:17 Compiling guile-gobject experiences Andreas Rottmann
2003-08-04 16:25 ` Andy Wingo
2003-08-04 16:58   ` Andreas Rottmann
2003-08-07  8:09     ` Andy Wingo
2003-08-07 11:18       ` Andreas Rottmann
2003-09-12 23:02   ` Kevin Ryde
2003-09-13 12:43     ` Marius Vollmer
2003-09-19  0:19       ` Kevin Ryde
2003-09-14 19:47     ` Andreas Rottmann
2003-09-15 17:59       ` GOOPS slowness [was: Compiling guile-gobject experiences] Andreas Rottmann
2003-09-19  0:18       ` Compiling guile-gobject experiences Kevin Ryde

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).