Unpack or Substr! Prace your bets now! Bet now!
So...I've got this tight loop where I need to whip a single character out of a ten char long string. Now this is Perl, so there's more than one way to do it, unpack and substr. Which is faster? So, the programs: substr: #!/usr/bin/perl my $string = #x10; for (1..5000) { my $foo = substr $string, 7, 1; print $foo; } unpack: #!/usr/bin/perl my $string = #x10; for (1..5000) { my $foo = unpack x7a1, $string; print $foo; } mark@pate:~/bench$ time perl substr /dev/null real2m3.976s user2m3.060s sys 0m0.130s mark@pate:~/bench$ time perl unpack /dev/null real4m48.582s user4m42.160s sys 0m0.230s So substr is much faster. Did this surprise anyone? And more importantly did anyone see any problems with my methodology? (for the record, perl 5.6.1 from x86 debian) Later. Mark. -- s'' Mark Fowler London.pm Bath.pm http://www.twoshortplanks.com/ [EMAIL PROTECTED] ';use Term'Cap;$t=Tgetent Term'Cap{};print$t-Tputs(cl);for$w(split/ +/ ){for(0..30){$|=print$t-Tgoto(cm,$_,$y). $w;select$k,$k,$k,.03}$y+=2}
Re: Tech meet, finalised.
On Thu, Jun 27, 2002 at 08:01:28PM +0100, Chris Ball ([EMAIL PROTECTED]) wrote: Hi, all. We appear to have a tech meet on our hands. The good people at Fotango have offered to play host for us on Thursday 18th July; we still need a projector, but I have a lead on that and I'm not begging shamelessly just yet. :-) Line-up so far: [snip] Any chance we can get this info up on the web site. I'd like to invite some people who aren't on the mailing list. Dave... -- ...she opened strange doors that we'd never close again
Re: Unpack or Substr! Prace your bets now! Bet now!
Mark Fowler sent the following bits through the ether: So substr is much faster. Did this surprise anyone? And more importantly did anyone see any problems with my methodology? No, seems fair enough. Of course, I'd probably have used the Benchmark module with '-w' and 'use strict' to catch any errors: #!/usr/bin/perl -w use strict; use Benchmark qw(cmpthese); my $string = # x 10; cmpthese(-10, { 'substr' = sub { my $foo = substr $string, 7, 1; }, 'pack' = sub { my $foo = unpack x7a1, $string; } }); Example results from my ibook and bleadperl: roo% perl bench.pl Benchmark: running pack, substr for at least 10 CPU seconds... pack: 13 wallclock secs (10.81 usr + 0.00 sys = 10.81 CPU) 270385.11/s(n=2922863) substr: 13 wallclock secs (10.83 usr + 0.00 sys = 10.83 CPU) 752117.91/s(n=8145437) Rate pack substr pack 270385/s -- -64% substr 752118/s 178% -- The important number is the rate (so substr is almost three times as fast). Of course, this sort of code is the kind of area where if you really need the speed, code the whole thing in C. Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ ... Know what I hate most? Rhetorical questions
[OT] Breaking and fixing sun hardware
I've got an ultra5 that is rather unwell (tends to blow the fuse in the PSU when you turn it on, and when it doesn't, doesn't give any output on serial or console) and quite possibly never worked from the factory (but for several reasons wasn't sorted under warranty) Does anyone know somewhere in london that'll take a look at it and give me a quick diagnosis/cost, or does anyone have enough experience of broken ultras to know what things I should check ? Replies off-list would probably cause least upset to those m[ou]nger who care less abaout these things than I. TIA the hatter
Re: Unpack or Substr! Prace your bets now! Bet now!
On Mon, Jul 01, 2002 at 10:54:26AM +0100, Mark Fowler wrote: So...I've got this tight loop where I need to whip a single character out of a ten char long string. Now this is Perl, so there's more than one way to do it, unpack and substr. Which is faster? I would've immediately thought substr -- it is presumably just a wrapper over the C library substr(2) which really doesn't do very much at all. On the other hand, unpack has to parse its template and presumably do some kind of state machine type stuff. That sounds to me much more involved than running a pointer over a bit of memory. Those more (er, at all) familiar with perl sources could comment more knowledgably I suspect... Paul -- Paul Makepeace ... http://paulm.com/ If we were a fashionable pink, then I would hug ya. -- http://paulm.com/toys/surrealism/
Re: Tech meet, finalised.
This very morning, Glorious Ex-Leader Dave Cross .sigged: ...she opened strange doors that we'd never close again I misread that as: ...ssh opened strange doors that we'd never close again Still rather appropriate, I thought. A ObPerl: Use 'perldoc -l' to tell you the location of a module on your system. 'perldoc -i' gives you case insensitivity which is also often useful. e.g. $ perldoc -li template /usr/local/lib/perl5/site_perl/5.6.1/i686-linux/Template.pm
Re: Unpack or Substr! Prace your bets now! Bet now!
Paul Makepeace sent the following bits through the ether: Those more (er, at all) familiar with perl sources could comment more knowledgably I suspect... The appropriate bit in the perl source here is pp.c. You want to look at PP(pp_substr), which should clearly explain what's going on. Except it doesn't. It's a mess of twisty Perl macros which hide where the action is actually getting done. For those interested in how it's done in Parrot, look at string_substr in string.c. Much cleaner, but the encoding stuff still confuses me... Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ ... All in all it's just a... 'nother brick in the wall!
Anyone up for a TPC6 skate jam?
Are there any skateboarders or inline skaters out there who are going to TPC6 and fancy getting together for a skate jam? San Diego is a Mecca for skateboarders. It has some of the finest skate parks in the World. I'm thinking about spending a day/afternoon checking out some of the best spots. But apart from Paul Makepeace (who I suspect isn't going to be at TPC6?) I don't know of anyone other Perl hackers who skate. Anyone interested? If it's just me then I'll take a cab to the nearest skate spot and play with myself (fnarr), but if there's a few of us then it might be worth hiring a car and touring a few different spots. Temecula, for example, some 60 miles north of San Diego is reputed to have one of the best indoor skateparks in the world. Within San Deigo, there's Mission Valley (featuring a 13ft vert ramp, probably the most photographed vert ramp in the world), Robb Field at Ocean Beach (41,000 square feet of concrete), Cronan Park on Coronada Island, home of some huge bowls, and at least a couple of others. Anyone? Class? Anyone? A
Re: Unpack or Substr! Prace your bets now! Bet now!
banzii On Mon, Jul 01, 2002 at 10:54:26AM +0100, Mark Fowler wrote: So...I've got this tight loop where I need to whip a single character out of a ten char long string. The Perl Character Cleaving Conundrum Now this is Perl, so there's more than one way to do it, unpack and substr. Which is faster? Place bets now! [tick...tick...tick] Betting Ends! mark@pate:~/bench$ time perl unpack /dev/null If you say unpack, you a loser! mark@pate:~/bench$ time perl substr /dev/null If you say substr, you the winner! /banzii So substr is much faster. Did this surprise anyone? No, not really. unpack is generic, substr is specific (i.e. substr grabs characters from strings whereas unpack grabs variable-length entities from a collection of bits and bytes). More specialised nearly always means faster and smaller. A
Re: Tech meet, finalised.
On Mon, Jul 01, 2002 at 11:09:12AM +0100, Dave Cross wrote: On Thu, Jun 27, 2002 at 08:01:28PM +0100, Chris Ball ([EMAIL PROTECTED]) wrote: We appear to have a tech meet on our hands. Any chance we can get this info up on the web site. I'd like to invite some people who aren't on the mailing list. I present my posterior for a good spanking. Meeting page now updated. Sorry, I've not got round to updating a few things on the site recently, I'll catch up over the weekend. Cheers Leo
Perldoc, was Re: Tech meet, finalised.
On Mon, 1 Jul 2002, Andy Wardley wrote: Use 'perldoc -l' to tell you the location of a module on your system. 'perldoc -i' gives you case insensitivity which is also often useful. e.g. $ perldoc -li template /usr/local/lib/perl5/site_perl/5.6.1/i686-linux/Template.pm However, that only works if the person has been nice enough to include some documentation for a module $ perldoc -l Template::Directive No documentation found for Template::Directive. If they have though, You can use the -m option to view the source in your pager as well. $ perldoc -m Test::Builder::Tester Though more often than not I find myself doing $ sudo emacs `perldoc -l Test::Builder::Tester` To load it up in emacs or suchlike. (This is another reason not to run always as root...perldoc will barf if you run it as root, but doing it with sudo the `` doesn't have root privlidiges at this point.) Later. Mark. -- s'' Mark Fowler London.pm Bath.pm http://www.twoshortplanks.com/ [EMAIL PROTECTED] ';use Term'Cap;$t=Tgetent Term'Cap{};print$t-Tputs(cl);for$w(split/ +/ ){for(0..30){$|=print$t-Tgoto(cm,$_,$y). $w;select$k,$k,$k,.03}$y+=2}
Re: Anyone up for a TPC6 skate jam?
On Mon, Jul 01, 2002 at 07:38:13AM -0700, Randal L. Schwartz wrote: Andy == Andy Wardley [EMAIL PROTECTED] writes: Andy Are there any skateboarders or inline skaters out there who are Andy going to TPC6 and fancy getting together for a skate jam? Hmm. Leaving out the quad skaters again, I see! I spent 10 hours a week for 10 years on real skates, where 8 wheels is all you ever needed. This inline fad will pass. :) /me counts wheels on his inlines. Looks like eight to me. Know thy enemy :-) Only the racers have five each. I bought some quads recently after being inspired by some serious disco moves at the Bagley's rollerdisco (RIP, or not who can tell) and they're great fun. But yeah, not going to TPC6 this year else I would definitely be up for skipping class for concrete. P (week away from IISA.org instructor qualification *crosses fingers*) -- Paul Makepeace ... http://paulm.com/ What is naked olive oil? Practice, practice, practice. -- http://paulm.com/toys/surrealism/
Re: Unpack or Substr! Prace your bets now! Bet now!
On Mon, Jul 01, 2002 at 12:37:05PM +0100, Paul Makepeace wrote: I would've immediately thought substr -- it is presumably just a wrapper over the C library substr(2) which really doesn't do very much Duh; I meant index(3). But the point is the basic idea of it fundamentally just being a pointer scree-ing along a block of memory being less complex than a state machine. See Andy's post :) Paul have imagination, will invent custom C libs M at all. On the other hand, unpack has to parse its template and presumably do some kind of state machine type stuff. That sounds to me much more involved than running a pointer over a bit of memory. -- Paul Makepeace ... http://paulm.com/ If the bed bugs bite, then what can you do. -- http://paulm.com/toys/surrealism/
Perl/CGI/Web Calendar Thing
Hello, I could really use a web/cgi/perl based calendar scheduling program, an initial google and browse around a couple of Perl web sites seems to show that there are a couple of choices. Before I dive in and start playing/working I was just wondering whether anybody had used any of these or whether there are any better alternatives that I should be looking at: WebCalendar: This seems the most fully featured. Good Demo. http://www.ma.utexas.edu/users/mzou/webCal/ WebCal: Looks pretty good. Demo. Less features than WebCalendar but more than the others. http://bulldog.tzo.org/webcal/webcal.html Calcium: Not massively feature packed. A online Demo. http://www.brownbearsoftware.com/calcium/ MyCalendar: Lightweight. No online Demo. http://freshmeat.net/projects/mycalendar Cheers, Adrian * The information contained in this communication is confidential, is intended only for the use of the recipient named above, and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please re-send this communication to the sender and delete the original message or any copy of it from your computer system. Thank You.
Re: Perl/CGI/Web Calendar Thing
On Mon, Jul 01, 2002 at 04:16:12PM +0100, Scottow Adrian - adscot wrote: Hello, I could really use a web/cgi/perl based calendar scheduling program, an initial google and browse around a couple of Perl web sites seems to show that there are a couple of choices. Before I dive in and start playing/working I was just wondering whether anybody had used any of these or whether there are any better alternatives that I should be looking at: I'm in *exactly* the same position right now. My primary requirements were a) open source b) decent docs. c) mod_perl support. So... WebCalendar: This seems the most fully featured. Good Demo. http://www.ma.utexas.edu/users/mzou/webCal/ I'm *scared* by the installer. No docs to speak of. I decided against installing it as I would have had to read the source and the installer in detail before I would consider trusting it. Shame really because it does almost everything I want. WebCal: Looks pretty good. Demo. Less features than WebCalendar but more than the others. http://bulldog.tzo.org/webcal/webcal.html Sucky docs. Again, I was unconvinced by the installer to the extent of not installing it. It also didn't mention mod_perl. Having looked at the database code I wasn't overly impressed either. Calcium: Not massively feature packed. A online Demo. http://www.brownbearsoftware.com/calcium/ Not open source. MyCalendar: Lightweight. No online Demo. http://freshmeat.net/projects/mycalendar Didn't look at this one yet. I'm currently examining hypercal. http://www.coopermcgregor.com/products/hypercal/ It looks nice but, the installation and documentation leave pretty well everything to be desired. I'm seriously considering strapping together some bits of CPAN and some Template Toolkit and writing the damn thing myself. Anyone got any other recommendations? nic -- Dead people don't go meep
Re: Perl/CGI/Web Calendar Thing
On or about Mon, Jul 01, 2002 at 03:43:36PM +0100, Nic Gibson typed: I'm seriously considering strapping together some bits of CPAN and some Template Toolkit and writing the damn thing myself. Anyone got any other recommendations? Make it compatible with ical (the Tcl application) and you've sold me on it... I haven't seen one I liked yet. Roger
Re: Perl/CGI/Web Calendar Thing
On Mon, Jul 01, 2002 at 04:44:06PM +0100, Roger Burton West wrote: On or about Mon, Jul 01, 2002 at 03:43:36PM +0100, Nic Gibson typed: I'm seriously considering strapping together some bits of CPAN and some Template Toolkit and writing the damn thing myself. Anyone got any other recommendations? Make it compatible with ical (the Tcl application) and you've sold me on it... I haven't seen one I liked yet. well, the current commute time makes it possible I suspect. I'll have a look at ical and the vcal (I think that's it) files that lots of things seem to share. I'm beginning to get damned close to giving up on this (the search for one that isn't unusable in some way or another) so it may well happen. Or maybe I should just write a decent installer for one of the existing ones that look plausible. nic -- love is the shit that makes life bloom
Re: Perl/CGI/Web Calendar Thing
From: Scottow Adrian - adscot [EMAIL PROTECTED] Date: 7/1/02 3:16:12 PM Hello, I could really use a web/cgi/perl based calendar scheduling program, an initial google and browse around a couple of Perl web sites seems to show that there are a couple of choices. Before I dive in and start playing/working I was just wondering whether anybody had used any of these or whether there are any better alternatives that I should be looking at: [snip] You should almost certainly be looking at the Reefknot projects. They are building Perl-based shared calendar software based on iCal. http://reefknot.sourceforge.net/ At the various conferences last year there was a lot of talk, but very little software. Hopefully there will be more stuff written by now, Dave... -- http://www.dave.org.uk Let me see you make decisions, without your television - Depeche Mode (Stripped)
RE: Perl/CGI/Web Calendar Thing
I could really use a web/cgi/perl based calendar scheduling program, No one's mentioned ReefKnot yet. It's not a web calendar, but it is an effort to implement a toolkit for RFC2445 compliant calendaring. They can probably point you in the direction of the current 'best' solution, and would probably welcome any efforts to improve the current state of the art. http://www.reefknot.org/ N -- 1234567890123456789012345678901234567890123456789012345678901234567890123456 7890 -- The 80 column-ometer Global Messaging 120 Cheapside, x83331
Re: Perl/CGI/Web Calendar Thing
On Mon, Jul 01, 2002 at 04:59:48PM +0100, Clayton, Nik [IT] wrote: I could really use a web/cgi/perl based calendar scheduling program, No one's mentioned ReefKnot yet. It's not a web calendar, but it is an effort to implement a toolkit for RFC2445 compliant calendaring. They can probably point you in the direction of the current 'best' solution, and would probably welcome any efforts to improve the current state of the art. http://www.reefknot.org/ Now that looks *very* interesting. I'll follow up on that one when I have some spare time and brain power. nic -- the following statement is true the preceding statement is false
[ANNOUNCE] First of the month meeting reminders
It's the first of the month, and also the Monday before the day after the first Wednesday of the month, so there's a social meeting soon. In fact, it's on Thursday, the fourth of July, from 6pm, back at the Cittie of Yorke. In my absence Chris Ball organised a technical meeting, which will be graciously hosted by Fotango on Thursday 18th July. Thanks to Leo there are details of this on the meetings page of the website. http://london.pm.org/meetings/ Hope to see you there. -- :: paul :: dave staugas loves bea hablig
Re: Perl/CGI/Web Calendar Thing
On 01/07/2002 at 17:06 +0100, Dave Cross wrote: You should almost certainly be looking at the Reefknot projects. They are building Perl-based shared calendar software based on iCal. http://reefknot.sourceforge.net/ At the various conferences last year there was a lot of talk, but very little software. Hopefully there will be more stuff written by now, There was a talk at YAPC::NA which I didn't attend, but I talked to a couple of the Boston-based folks working on it who said the gist was 'this is where we were, we haven't got much further, and these hard problems are why'. Shared calendaring is hard. Shared calendaring that needs to observe timezones is *very* hard. Calendaring that does repeating events is also hard. If you can avoid these requirements it might be easier. iCal compliance is definitely something you should be aiming at, though, even if it adds to the hardness. -- :: paul :: dave staugas loves bea hablig
Re: Perl/CGI/Web Calendar Thing
On Mon, Jul 01, 2002 at 09:06:03AM -0700, Dave Cross wrote: You should almost certainly be looking at the Reefknot projects. They are building Perl-based shared calendar software based on iCal. Note that iCal - which I don't know about - is not the same thing as ical, which used to be at http://www.research.digital.com/SRC/personal/Sanjay_Ghemawat/ical/home.html but now only exists as a Debian package (as far as I can tell). Roger
Re: Anyone up for a TPC6 skate jam?
Andy == Andy Wardley [EMAIL PROTECTED] writes: Andy Are there any skateboarders or inline skaters out there who are Andy going to TPC6 and fancy getting together for a skate jam? Hmm. Leaving out the quad skaters again, I see! I spent 10 hours a week for 10 years on real skates, where 8 wheels is all you ever needed. This inline fad will pass. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Tech meet, finalised.
On Mon, Jul 01, 2002 at 02:21:54PM +0100, Andy Wardley wrote: This very morning, Glorious Ex-Leader Dave Cross .sigged: ...she opened strange doors that we'd never close again I misread that as: ...ssh opened strange doors that we'd never close again Still rather appropriate, I thought. ...and apt, considering our ssh woes... ;-) -- Natalie S. Ford ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø [EMAIL PROTECTED] http://www.natalie.ourshack.org/ http://natalief.livejournal.com/
Re: [OT] Breaking and fixing sun hardware
On Mon, Jul 01, 2002 at 10:45:34AM +, the hatter wrote: I've got an ultra5 that is rather unwell (tends to blow the fuse in the PSU when you turn it on, and when it doesn't, doesn't give any output on serial or console) and quite possibly never worked from the factory (but for several reasons wasn't sorted under warranty) Does anyone know somewhere in london that'll take a look at it and give me a quick diagnosis/cost, or does anyone have enough experience of broken ultras to know what things I should check ? Ultra 5s don't have an auto-switching power supply. Check that it's set to the right voltage. If it is, then fuck knows, but if not, then you may have completely fubared it. -- David Cantrell | [EMAIL PROTECTED] | http://www.cantrell.org.uk/david WARNING! People in front of screen are stupider than they appear -- Tanuki the Raccoon-dog, in the Monastery
A very odd question
This is, no doubt, a very odd question, but I'm sure that *someone* here - we have many many lurkers as well as the regular posters - will be able to help. I want to get my HGV licence. Anyone recommend a driving school in saaf Landan? -- David Cantrell | Member of the Brute Squad | http://www.cantrell.org.uk/david 23.5 degrees of axial tilt is the reason for the season
Re: A very odd question
I want to get my HGV licence. Anyone recommend a driving school in saaf Landan? Can't help you directly, but there has been some discussion of HGV training in uk.rec.driving lately, and you're sure to get some good answers if you ask there. Good luck! Cheers, Pete
Re: A very odd question
David Cantrell [EMAIL PROTECTED] wrote: I want to get my HGV licence. Anyone recommend a driving school in saaf Landan? Didn't know you needed a licence to drive a HGV in saaf Landan... A licence certainly seems to be a bonus rather than a requirement for most of the HGV drivers I meet when I cycle to work... Ian _ Chat with friends online, try MSN Messenger: http://messenger.msn.com
Re: Anyone up for a TPC6 skate jam?
Paul == Paul Makepeace [EMAIL PROTECTED] writes: Paul I bought some quads recently after being inspired by some serious disco Paul moves at the Bagley's rollerdisco (RIP, or not who can tell) and they're Paul great fun. Ahh, the place that invented rollerdisco, Roxy's in Manhattan, is still running one night a week of roller, from what I saw last time I was there. Just another Roller Performance Skater, -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!