Message-ID: <1915332214.1767.1432859087900.JavaMail.firstname.lastname@example.org> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_1766_1764150328.1432859087900" ------=_Part_1766_1764150328.1432859087900 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This benchmark compares a duck typed call to a normal call. Duck Typing calls are about 160 times = slower.=20 =20
Boo's Duck Typing uses type.Inv= okeMember (System.Reflection), which can be very slow. To speed it up, you = need to replace the duck types with static type casts (see Casting Types) or type declarations ("x as = int").=20
See this thread= . In the example, a million items of unknown type are added to a list a= fter being upper-cased (if a string) or added (if an int).=20
Boo is pretty much as fast as other statically typed languages when you = use static typing. It takes only .34 seconds to do this example on my machi= ne.=20
But using Duck Typing or the -d= ucky option may make your code slower than regular Python (~1.5 seconds for= boo with duck typing vs. ~1 second for Python). About 50% slower in this e= xample. Note, I am not saying Python is slow. In fact Python + Psyco is jus= t as fast (.32s) as optimized C# code in this particular example.