![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Inline::C hash accessby jettero (Monsignor) |
on Sep 04, 2008 at 11:55 UTC ( #708995=note: print w/replies, xml ) | Need Help?? |
For the method shown here, I doubt it would make much difference, and if it did, it'd probably be to slow it down rather than speed it up. If you're going to write things in C to speed them up, then it helps to have the data in C structures and access it there. Otherwise you might as well just use perl instead of introducing additional access layers.
Still, I could be wrong since the slowest part of perl is calling a sub. If you called your C function the hundreds of thousands of times from the C code (rather than from perl), it could possibly speed it up. UPDATE: also, I've completed my assignment. I hope I get an A on my homework. (In all seriousness, I've never tried Inline::C before. Normally I don't write complete solutions...) BTW, the secret to figuring this stuff out is: you can't. It's really really arcane. But these pages can help: perlxs, perlapi, perlguts, perlxstut, perlclib, and perlcall. I used perlxs, perlapi, perlguts, and some source I had written before to figure this out. It can also help to browse the source of perl itself.
-Paul
In Section
Seekers of Perl Wisdom
|
|