I've seen improvements on this scale by replacing Perl code with C.

I had a dynamic-programming string comparison algorithm, which compares all
the subsequences of a short string against a longer one.  It creates an
array of size approximately 500x20, and reuses the same array every time to
avoid creating a new one and garbage collecting old ones. The program calls
the comparison function to populate and search this table somewhere around
20'000 times. 

I tried this in perl first, and profiled it using the -d:DProf option.  The
time per call was 0.0095 seconds, giving a total cumulative time of 186
seconds for 20000 calls.

I replaced the perl function with the C equivalent embedded in the Perl
using Inline::C.  On the same dataset, the cumulative time taken up by the
calls was only 1.28 seconds.  I suspect the speed up was due to the sheer
speed with which C can access arrays compared to Perl.




-----Original Message-----
From: Bharucha, Nikhil [mailto:[EMAIL PROTECTED] 
Sent: 23 June 2004 14:39
To: Jaime Teng; [EMAIL PROTECTED]
Subject: RE: assembly codes inside perl?

You may want to look at your Perl code first.  I can't see such a big
difference between C++ and Perl.

-----Original Message-----
From: Jaime Teng [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 23, 2004 9:26 AM
To: [EMAIL PROTECTED]
Subject: assembly codes inside perl?

Hi,

Has anyone done some Assembly Language Programming 
inserted into Perl scripts?

If so, can you show a sample?

I am in need of speeding up a very recursive function;
in perl, it took almost an hour; in C++, it took a few
seconds. I wanted more speed.

thanks.

Jaime


Email Advisory==================================================
To ensure delivery of message to [EMAIL PROTECTED], please contact your
email provider and ask them if your email server has a valid DNS entry.
Public Email Servers must have a valid hostname and routeable public IP
Address per RFC1912 compliance.

To test the compliance of your email server, please send an email to:
[EMAIL PROTECTED]; our server will reply with a result within
minutes.
==================================================Email Advisory

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
This message contains confidential and potentially legally privileged
information solely for its intended recipients and others may not
distribute, copy or use it. If you have received this communication in
error, please tell us by return email and delete it, and any copies of it.
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to