The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

Ned Batchelder ned at nedbatchelder.com
Thu Mar 24 13:13:51 EDT 2016


On Thursday, March 24, 2016 at 12:12:55 PM UTC-4, BartC wrote:
> On 24/03/2016 15:30, Ned Batchelder wrote:
> > On Thursday, March 24, 2016 at 9:51:11 AM UTC-4, Steven D'Aprano wrote:
> >> You know what is missing from this conversation?
> >>
> >> For one of Bart's critics to actually show faster code.
> >>
> >> There's plenty of people telling him off for writing unpythonic and slow
> >> code, but I haven't seen anyone actually demonstrating that Python is
> >> faster than his results show.
> >
> > As I mentioned before, I'm happy to explain the fuller Python way to
> > write code, but I don't think Bart wants to learn it, because he is
> > focused on a different goal than, "write real Python code the best
> > possible way."
> >
> > Here, for example, is a real lexer for JavaScript that I wrote:
> > https://bitbucket.org/ned/jslex/src
> >
> 
> Thanks for that.
> 
> I don't have any JS to throw at it, but it seems happy with any bits of 
> source code or even just text.
> 
> Using your short driver program (with the prints commented out), and 
> tested with 'bible.txt' as input (ie. mostly English words), then your 
> JS lexer was roughly half the speed of the Python version I linked to 
> last week (with the if-elif chains and working with strings).

I have tried to find your code, but cannot find in the forest of this thread.
Can you provide a link to it online?  I would be very interested to understand
the difference in performance.

Thanks,

--Ned.



More information about the Python-list mailing list