Excellent work! The oneDiv2 function really does shine but considering
the prevalence of FF and IE6/7, I would still be hard pressed to choose
it over String.replace. Either way, they are both a big improvement over
the original Prototype method (with the exception of String.replace for
Opera and Intel Safari). Take the last step and submit a patch with
your results to back it up :)
Thanks,
Colin
Marius Feraru wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Marius Feraru wrote:
Sorry, I have no Intel based Mac available at this hour, maybe S bastien
could help us. ;-)
Talked too soon, my folks are still alive ;-)
Benchmarks run using 10000 iterations on these browsers:
A. Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20061222
Firefox/2.0.0.1
B. Opera/9.10 (X11; Linux i686; U; en)
C. Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
2.0.50727; FDM)
D. Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like
Gecko)
E. Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)
F. Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.8.1
(KHTML, like Gecko) Safari/312.6
G. Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1)
Gecko/20061010 Firefox/2.0
H. Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.1)
Gecko/20061204 Firefox/2.0.0.1
I. Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/418
(KHTML, like Gecko) Safari/417.9.2
Method execution rate (per second) per browser:
Method A B C D E F G
H I
Prototype 3197 17094 4182 3959 4704 3598 3162
8803 24096
Prototype.oneDiv 2548 16529 5005 4006 5283 5851 1826
6017 20833
Prototype.oneDiv2 8170 51020 13405 8258 10953 13477 6588
16667 39841
String.replace 15175 6739 15699 4468 15949 1604 10526
32051 20619
String.replaceMap 8905 9699 12804 4008 16584 1694 6540
15221 24213
String.split 10163 27322 9681 4983 10373 1730 6954
17241 27548
Top method per browser:
Method A B C D E F G
H I AVG
Prototype 5 3 6 6 6 3 5
5 4 4.78
Prototype.oneDiv 6 4 5 5 5 2 6
6 5 4.89
Prototype.oneDiv2 4 1 2 1 3 1
3 3 1 2.11
String.replace 1 6 1 3 2 6 1
1 6 3.00
String.replaceMap 3 5 3 4 1 5
4 4 3 3.56
String.split 2 2 4 2 4 4 2
2 2 2.67
So this new method really looks like being our winner ;-)
- --
Marius Feraru
-----BEGIN PGP SIGNATURE-----
iD8DBQFFn60gtZHp/AYZiNkRAm7PAJ9lOvg+9xB95P0UrgB+c3QlqK94ZgCfWslH
n3KwHx5c+goOZeVUY26dJfU=
=8PFS
-----END PGP SIGNATURE-----
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---