Re: Standalone Pango, take two




On Nov 2, 2008, at 10:39 AM, Torsten Schoenfeld wrote:


• Performance: 'use Gtk2' got 3% slower on my machine. (That is, 'use Gtk2' now takes 1.03 times the time it takes without the patch.) Should we worry about that?

That's not very much, and it's undoubtedly due to the added seeks & DSO load for Pango.so, as well as the API fixups.

The obvious fix would be lazy-loading, which might actually be a win for lots of programs. After all, you don't *have* to call Pango functions in your user code to have a useful Gtk2 app.

The trick would be figuring out how to defer loading Pango.pm (and the corresponding Pango.so) until actually needed. That starts to sound like more complexity than warranted for fixing a 3% slowdown.




• The yellow-wiring foreach loop in Gtk2.pm worries me a bit:

 foreach my $key (keys %Pango::) {
   *{"Gtk2::Pango::" . $key} = *{"Pango::" . $key};
 }

It automatically maps everything from Pango::* to Gtk2::Pango::*. This includes some stuff that probably shouldn't be there, like BEGIN or bootstrap or dl_load_flags or EXPORT*. See the complete list:

 perl -MPango -le'map { print } keys %Pango::' | sort

More importantly even, the loop will also automatically map over any new API we add to Pango, thus indirectly changing Gtk2's API. Is it better to hardcode the stuff that should be mapped over?

That's not a feature?  ;-)

The hardcoded list would effectively freeze the Gtk2::Pango API, which might be a good idea.

Anything else would, i believe, involve some AUTOLOAD magic. Might be worth experimenting, but i'm drawing a blank on exactly what it ought to do.




• The yellow-wiring foreach loop somehow makes these two evaluate to true:

 Pango::Layout->isa (Gtk2::Pango::Layout::)
 Gtk2::Pango::Layout->isa (Pango::Layout::)

I don't understand why or how it does that. Is that a mechanism we can rely on? It is important that the two expressions are true for backwards compatibility. (I tested it with perl 5.8.8, 5.10.0, and blead -- it seems to work fine in every case.)


If i'm reading the globbing expression correctly, it looks like putting the same references in both symbol tables instead of just copying.

Might be better to inquire on p5p.



• The old POD and man pages Gtk2::Pango::* are basically gone. The attached patch adds some POD to xs/Gtk2.xs that makes the code generator create stub pages under Gtk2::Pango::* that explain the situation and link to the relevant Pango::* page. Is that good enough?


s/relevent/relevant/g in the pod.



--
I've been using emacs for 20+ years and have barely touched lisp. I wouldn't know lambda calculus if it took all its clothes off and waved a placard that reads "I am lambda calculus" in blinking 48-point Comic Sans.
  -- Dave Hodgkinson, on london.pm




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]