Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #18758
| From | Lie Ryan <lie.1296@gmail.com> |
|---|---|
| Subject | Re: python philosophical question - strong vs duck typing |
| Date | 2012-01-11 00:05 +1100 |
| References | <CAOFf2a0dG1tR1-2sJnqCCGqVXocqvzGScGeDJXeXwKdfdvuT-Q@mail.gmail.com> <mailman.4383.1325623116.27778.python-list@python.org> <59305aab-7ddf-4c61-b8ba-025a2ce10b48@d10g2000vbh.googlegroups.com> <4f0a7ca9$0$1727$742ec2ed@news.sonic.net> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4593.1326200757.27778.python-list@python.org> (permalink) |
On 01/09/2012 04:35 PM, John Nagle wrote: > A type-inferring compiler has to analyze the whole program at > once, because the type of a function's arguments is determined > by its callers. This is slow. The alternative is to guess > what the type of something is likely to be, compile code at > run time, and be prepared to back out a bad guess. This > requires a very complex system, but that's how PyPy does it. > Performance does not seem to reach Shed Skin levels. With a smart enough compiler, JIT compiler can actually be faster than compile-time optimizations; the reason being that different people might use the same code differently. For example, say we have a function that takes an array of numbers which can be integer or float or a mix of integers and floats. A compile-time optimizer cannot optimize this function safely; but a run-time optimizer might notice that a certain user only ever use the function with an array of integers and generate an optimized code for that particular case. Profile-guided optimizations (PGO) can do something similar, but then it means a single program will have to have twenty different binaries for twenty different use cases; or a very large binary that contains code optimized for every possible thing.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: python philosophical question - strong vs duck typing Terry Reedy <tjreedy@udel.edu> - 2012-01-03 15:38 -0500
Re: python philosophical question - strong vs duck typing Ben Finney <ben+python@benfinney.id.au> - 2012-01-04 10:10 +1100
Re: python philosophical question - strong vs duck typing alex23 <wuwei23@gmail.com> - 2012-01-03 18:15 -0800
Re: python philosophical question - strong vs duck typing John Nagle <nagle@animats.com> - 2012-01-08 21:35 -0800
Re: python philosophical question - strong vs duck typing Robert Kern <robert.kern@gmail.com> - 2012-01-09 10:45 +0000
Re: python philosophical question - strong vs duck typing John Nagle <nagle@animats.com> - 2012-01-13 09:30 -0800
Re: python philosophical question - strong vs duck typing Lie Ryan <lie.1296@gmail.com> - 2012-01-11 00:05 +1100
csiph-web