Never forget that most often there are 3,4,5 ways of doing something in
Perl.  Some ways are slower but may not seem so unless under heavy load.

Perl meets my needs and is very fast with arrays.  Of course if you have
a process that performs something like a simple math function many many
times then the only way to guarantee that it is doing so efficiently is
to code it in Assembler where you have full control.  

We had a situation where compiled C code was performing 9 instructions
where it was replaced by 1 instruction in Assembler.  The example
immediately below would probably be even faster if coded in Assembler --
but Assembler should be the last resort.

-----Original Message-----
From: Mark Harris [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 23, 2004 10:03 AM
To: [EMAIL PROTECTED]
Subject: RE: assembly codes inside perl?

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


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

Reply via email to