On equal footing JavaScript will almost always be slower than PERL -
JavaScript carries a lot of baggage and is not as optimized for RegEx's as
Perl is. However in practice Perl runs on the server and is doing many more
tasks while the client is sitting spinning it's wheels - so JavaScript seems
much faster (it has a whole machine sitting there to do this little script
while the server might be doing dozens, or hundreds of requests at the same
time).
So - purely from a performance standpoint - JavaScript may be "faster". You
may eliminate a server request and provide the interface "instant feedback"
(although remember that you'll be delivering more script to the client which
slows things down some).
However it's not safer. Script can be disabled - which would eliminate your
checking completely. Since it runs on the client-side it can also be
modified to return incorrect results. In general you should consider
validations at every level of your application.
source: http://bytes.com/topic/javascript/answers/164154-javascript-vs-perl-regexp
No comments:
Post a Comment