From: Eric W. <scr...@gm...> - 2007-03-19 10:22:32
|
# from Eriam Schaffter # on Monday 19 March 2007 02:42 am: >By the way, I've not done any testing of XRC performance, is it really > as slow as Eric Wilhelm described it ? > >I mean is it worth using it or is the performance loss so huge that it >really makes it un-usable .. ? > >Thanks for any pointers. My observations are based on the following http://scratchcomputing.com/tmp/calc.pl http://scratchcomputing.com/tmp/calc.xrc Comment-out the IDLE event at the bottom to have it not immediately exit. $ time ./calc.pl bye at ./calc.pl line 150. real 0m2.140s user 0m0.929s sys 0m1.167s Then, using the dotReader testing hook, which also happens in the first IDLE event: $ time DOTREADER_TEST='print "ok\n";' ./run ok real 0m1.939s user 0m1.628s sys 0m0.182s dotReader loads *at least* 222 .pm files in that amount of time and creates a gui window. While calc.pl (stolen from a python xrc example) only creates a primitive calculator with 3 TextCtrls. Using Devel::DProf shows that 70% of the time is spent in the (supposedly C++ and expat-based) Wx::XmlResource::Load method. That just scares me. That is, however Wx 0.27 (yeah, I know, feel free to come upgrade sarge to etch for me and ruin my week^Wmonth while I discover everything else that KDE has managed to break in the last few months, deal with mozilla (which we *were* embedding) rolling over, etc..) Maybe it has gotten better, but those numbers just scream "something is wrong" to me. Add to that the fact that you can't even declare events in XRC, plus the difficulties with storing your object data in your sizer datha, plus the very awkward process of turning strings into integers in order to do anything with the objects (hey, this is Perl! Turning my strings into method calls or accessors is much more useful!) and I just have to think chucking the whole ball of XML out the window and forgetting I ever heard about it is probably going to allow me to sleep better at night. I'm not saying data-driven layout and configuration can't be done, but I'll bet XRC ain't it. Particularly in Perl. I can just imagine the if/else code that must be happening in C++ (though maybe they managed something involving hashes and function pointers... is "call a method given by a runtime string" even possible?) In any case, the GetXRCID("string") stuff is rather silly. Just watch me try to make any of that concise in InitMenu() of calc.pl. Feel free to laugh at my pain too. Please do show me some sympathy since I was trying to make this as much of a "straight and academic port" of the python code as I could bear. Trust me, there a lot of "oh, man... how could anyone bear to write in such a verbose language as python!" and various other lamentations (expressed in less palatable words) involved ;-) Heh. Could be worse. We could be trying to work from wxPHP documentation! --Eric -- But you can never get 3n from n, ever, and if you think you can, please email me the stock ticker of your company so I can short it. --Joel Spolsky --------------------------------------------------- http://scratchcomputing.com --------------------------------------------------- |