Re: [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20

2018-04-27 Thread Cesare Di Mauro
Hi, 2018-04-28 5:08 GMT+02:00 Armin Rigo : > Hi, > > On 26 April 2018 at 07:50, Raymond Hettinger > wrote: > >> [Raymond Hettinger ] > >>> After re-reading all the proposed code samples, I believe that > >>> adopting the PEP will make the language harder to teach to people > >>> who are not alre

Re: [Python-Dev] Python startup time

2017-07-20 Thread Cesare Di Mauro
2017-07-21 4:52 GMT+02:00 Nick Coghlan : > On 21 July 2017 at 12:44, Nick Coghlan wrote: > > We can separately measure the cost of unmarshalling the code object: > > > > $ python3 -m perf timeit -s "import typing; from marshal import loads; > from > > importlib.util import cache_from_source; cach

Re: [Python-Dev] Python startup time

2017-07-20 Thread Cesare Di Mauro
2017-07-20 19:23 GMT+02:00 Victor Stinner : > 2017-07-20 19:09 GMT+02:00 Cesare Di Mauro : > > I assume that Python loads compiled (.pyc and/or .pyo) from the stdlib. > That's something that also influences the startup time (compiling source vs > loading pre-compiled module

Re: [Python-Dev] Python startup time

2017-07-20 Thread Cesare Di Mauro
2017-07-19 16:26 GMT+02:00 Victor Stinner : > 2017-07-19 15:22 GMT+02:00 Oleg Broytman : > > On Wed, Jul 19, 2017 at 02:59:52PM +0200, Victor Stinner < > victor.stin...@gmail.com> wrote: > >> "Python is very slow to start on Windows 7" > >> https://stackoverflow.com/questions/29997274/python-is- >

Re: [Python-Dev] Micro-optimizations by adding special-case bytecodes?

2017-05-25 Thread Cesare Di Mauro
Hi Ben, for what you're interested in, you might give a look at WPython 1.0 ( https://code.google.com/archive/p/wpython/downloads ) and 1.1 ( https://code.google.com/archive/p/wpython2/downloads ), but they cover a lot of optimizations (as you can see from a brief look at the slides): RETURN_CONST

Re: [Python-Dev] Speeding up CPython 5-10%

2016-05-18 Thread Cesare Di Mauro
> > Anyway, just offering things already written. If you don't feel it's > useful, no worries. > > > On Wed, May 18, 2016, at 11:35 AM, Cesare Di Mauro wrote: > > 2016-05-17 8:25 GMT+02:00 : > > In the project https://github.com/zachariahreed/byteasm I m

Re: [Python-Dev] Speeding up CPython 5-10%

2016-05-18 Thread Cesare Di Mauro
2016-05-17 8:25 GMT+02:00 : > In the project https://github.com/zachariahreed/byteasm I mentioned on > the list earlier this month, I have a pass that to computes stack usage > for a given sequence of bytecodes. It seems to be a fair bit more > agressive than cpython. Maybe it's more generally use

Re: [Python-Dev] Speeding up CPython 5-10%

2016-05-16 Thread Cesare Di Mauro
2016-05-16 17:55 GMT+02:00 Meador Inge : > On Sun, May 15, 2016 at 2:23 AM, Cesare Di Mauro < > cesare.di.ma...@gmail.com> wrote: > > >> Just one thing that comes to my mind: is the stack depth calculation >> routine changed? It was suboptimal, and calculating a be

Re: [Python-Dev] Speeding up CPython 5-10%

2016-05-15 Thread Cesare Di Mauro
2016-02-01 17:54 GMT+01:00 Yury Selivanov : > Thanks for bringing this up! > > IIRC wpython was about using "fat" bytecodes, i.e. using 64bits per > bytecode instead of 8. No, it used 16, 32, and 48-bit per opcode (1, 2, or 3 16-bit words). > That allows to minimize the number of bytecodes, th

Re: [Python-Dev] Wordcode: new regular bytecode using 16-bit units

2016-05-15 Thread Cesare Di Mauro
2016-04-13 23:23 GMT+02:00 Victor Stinner : > Hopefully, I don't expect 32-bit parameters in the wild, only 24-bit > parameter for function with annotation. > I never found 32-bit parameters, and not even 24-bit ones. I think that their usage is as rare as all planets alignment. ;-) That's why w

Re: [Python-Dev] Wordcode: new regular bytecode using 16-bit units

2016-05-15 Thread Cesare Di Mauro
2016-04-13 18:24 GMT+02:00 Victor Stinner : > Demur Rumed proposes a different change to use a regular bytecode > using 16-bit units: an instruction has always one 8-bit argument, it's > zero if the instruction doesn't have an argument: > >http://bugs.python.org/issue26647 > > According to ben

Re: [Python-Dev] Wordcode v2

2016-05-15 Thread Cesare Di Mauro
2016-02-17 12:04 GMT+01:00 Antoine Pitrou : > Demur Rumed gmail.com> writes: > > I've personally benchmarked this fork with positive results. > > I'm skeptical of claims like this. What did you benchmark exactly, and with > which results? > I don't think changing the opcode encoding per se will b

Re: [Python-Dev] Wordcode v2

2016-05-15 Thread Cesare Di Mauro
2016-02-15 8:14 GMT+01:00 Andrew Barnert via Python-Dev < python-dev@python.org>: > Despite the name (and inspiration), my fork has very little to do with > WPython. I'm just focused on simpler (hopefully = faster) fetch code; he > started with that, but ended up going the exact opposite direction

Re: [Python-Dev] Wordcode v2

2016-05-15 Thread Cesare Di Mauro
2016-02-15 1:20 GMT+01:00 Demur Rumed : > Saw recent discussion: > https://mail.python.org/pipermail/python-dev/2016-February/143013.html > > I remember trying WPython; it was fast. Unfortunately it feels it came at > the wrong time when development was invested in getting py3k out the door. > No

Re: [Python-Dev] Speeding up CPython 5-10%

2016-05-15 Thread Cesare Di Mauro
2016-02-02 10:28 GMT+01:00 Victor Stinner : > 2016-01-27 19:25 GMT+01:00 Yury Selivanov : > > tl;dr The summary is that I have a patch that improves CPython > performance > > up to 5-10% on macro benchmarks. Benchmarks results on Macbook Pro/Mac > OS > > X, desktop CPU/Linux, server CPU/Linux are

Re: [Python-Dev] A new JIT compiler for a faster CPython?

2012-07-17 Thread Cesare Di Mauro
2012/7/18 Steven D'Aprano > WPython in particular seems to be very promising, and quite fast. I don't > understand why it doesn't get more attention (although I admit I can't > criticise, since I haven't installed or used it myself). > > > http://www.pycon.it/media/stuff/slides/beyond-bytecode-a-

Re: [Python-Dev] A new JIT compiler for a faster CPython?

2012-07-17 Thread Cesare Di Mauro
2012/7/18 Victor Stinner > I don't expect to run a program 10x faster, but I would be happy if I > can run arbitrary Python code 25% faster. > If that's your target, you don't need to resort to a bytecode-to-binary-equivalent compiler. WPython already gave similar results with Python 2.6. The i

Re: [Python-Dev] Python 3 optimizations continued...

2011-09-01 Thread Cesare Di Mauro
2011/9/1 Mark Shannon > Cesare Di Mauro wrote: > >> 2011/9/1 Ned Batchelder > n...@nedbatchelder.com>> >> >> >>When the switchover to the new instruction format happens, what >>happens to sys.settrace() tracing? Will it report the same seq

Re: [Python-Dev] Python 3 optimizations continued...

2011-09-01 Thread Cesare Di Mauro
2011/9/1 Ned Batchelder > When the switchover to the new instruction format happens, what happens to > sys.settrace() tracing? Will it report the same sequence of line numbers? > For a small but important class of program executions, this is more > important than speed. > > --Ned > A simple s

Re: [Python-Dev] Python 3 optimizations continued...

2011-08-31 Thread Cesare Di Mauro
2011/8/31 Guido van Rossum > On Tue, Aug 30, 2011 at 10:04 PM, Cesare Di Mauro > wrote: > > It isn't, because motivation to do something new with CPython vanishes, > at > > least on some areas (virtual machine / ceval.c), even having some ideas > to > > exp

Re: [Python-Dev] Python 3 optimizations continued...

2011-08-31 Thread Cesare Di Mauro
2011/8/31 stefan brunthaler > > I think that you must deal with big endianess because some RISC can't > handle > > at all data in little endian format. > > > > In WPython I have wrote some macros which handle both endianess, but > lacking > > big endian machines I never had the opportunity to ver

Re: [Python-Dev] Python 3 optimizations continued...

2011-08-30 Thread Cesare Di Mauro
2011/8/31 Terry Reedy > I find myself more comfortable with the Cesare Di Mauro's idea of expanding > to 16 bits as the code unit. His basic idea was using 2, 4, or 6 bytes > instead of 1, 3, or 6. > It can be expanded to longer than 6 bytes opcodes, if needed. The format is designed to be flexi

Re: [Python-Dev] Python 3 optimizations continued...

2011-08-30 Thread Cesare Di Mauro
2011/8/30 stefan brunthaler > > Do I sense that the bytecode format is no longer platform-independent? > > That will need a bit of discussion. I bet there are some things around > > that depend on that. > > > Hm, I haven't really thought about that in detail and for longer, I > ran it on PowerPC

Re: [Python-Dev] Python 3 optimizations continued...

2011-08-30 Thread Cesare Di Mauro
2011/8/30 stefan brunthaler > Yes, indeed I have a more straightforward instruction format to allow > for more efficient decoding. Just going from bytecode size to > word-code size without changing the instruction format is going to > require 8 (or word-size) times more memory on a 64bit system.

Re: [Python-Dev] Python 3 optimizations continued...

2011-08-30 Thread Cesare Di Mauro
2011/8/30 Nick Coghlan > > Yeah, it's definitely a trade-off - the point I was trying to make is > that there *is* a trade-off being made between complexity and speed. > > I think the computed-gotos stuff struck a nice balance - the macro-fu > involved means that you can still understand what the

Re: [Python-Dev] Python 3 optimizations continued...

2011-08-30 Thread Cesare Di Mauro
2011/8/30 Antoine Pitrou > Changing the bytecode width wouldn't make the interpreter more complex. It depends on the kind of changes. :) WPython introduced a very different "intermediate code" representation that required a big change on the peepholer optimizer on 1.0 alpha version. On 1.1 fi

Re: [Python-Dev] CPython optimization: storing reference counters outside of objects

2011-05-24 Thread Cesare Di Mauro
2011/5/24 Stefan Behnel > Maciej Fijalkowski, 24.05.2011 13:31: > > CPython was not designed for CPU cache usage as far as I'm aware. >> > > That's a pretty bold statement to make on this list. Even if it wasn't > originally "designed" for (efficient?) CPU cache usage, it's certainly been > aro

Re: [Python-Dev] CPython optimization: storing reference counters outside of objects

2011-05-22 Thread Cesare Di Mauro
2011/5/23 "Martin v. Löwis" > > I'm not a compiler/profiling expert so the main question is if such > > design can work, and maybe someone was thinking about something > > similar? > > My expectation is that your approach would likely make the issues > worse in a multi-CPU setting. If you put mul

[Python-Dev] PyLongObject "safe" changes?

2011-03-20 Thread Cesare Di Mauro
Hi I have little knowledge of some Python (3.2) internals on objects' internal structure handling. Suppose that I have any PyLongObject object (even internal / shared ones) and that - I need to change some or all of its internal values (size, sign, digits) in a "critical section"; - the critical

Re: [Python-Dev] Suggest reverting today's checkin (recursive constant folding in the peephole optimizer)

2011-03-14 Thread Cesare Di Mauro
2011/3/14 Alexander Belopolsky > On Sat, Mar 12, 2011 at 1:08 PM, Raymond Hettinger > wrote: > > I would like to withdraw my suggestion for the recursive constant folding > patch to be reverted. > > So what is the status of peephole optimization now? Is it back under > active development? Let

Re: [Python-Dev] Suggest reverting today's checkin (recursive constant folding in the peephole optimizer)

2011-03-11 Thread Cesare Di Mauro
2011/3/12 Benjamin Peterson > 2011/3/11 Raymond Hettinger : > > Today, there was a significant check-in to the peephole optimizer that I > > think should be reverted: > >http://hg.python.org/cpython/rev/14205d0fee45/ > > The peephole optimizer pre-dated the introduction of the abs

Re: [Python-Dev] Byte code arguments from two to one byte: did anyone try this?

2011-01-31 Thread Cesare Di Mauro
2011/1/31 Terry Reedy > On 1/31/2011 5:31 AM, Steven D'Aprano wrote: > >> Jurjen N.E. Bos wrote: >> >>> I was impressed by the optimizations already in there, but I still >>> dare to suggest an optimization that from my estimates might shave off >>> a few cycles, speeding up Python about 5%. >>>

Re: [Python-Dev] short fetch for NEXTARG macro (was: one byte byte code arguments)

2011-01-31 Thread Cesare Di Mauro
2011/1/31 Antoine Pitrou > On Mon, 31 Jan 2011 13:28:39 +0100 > "Jurjen N.E. Bos" wrote: > > I just did it: my first python source code hack. > > I replaced the NEXTARG and PEEKARG macros in ceval.c using a cast to > > short pointer, and lo and behold, a crude measurement indicates one > > to tw

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-02 Thread Cesare Di Mauro
2011/1/3 Alex Gaynor > No, it's singularly impossible to prove that any global load will be any > given > value at compile time. Any optimization based on this premise is wrong. > > Alex > That's your opinion, but I have very different ideas. Of course we can't leave the problem only on the co

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2011-01-02 Thread Cesare Di Mauro
2011/1/1 Ned Batchelder > On 12/31/2010 12:51 PM, Cesare Di Mauro wrote: > > "Aggressive" optimizations can be enabled with explicit options, in order > to leave normal "debugger-prone" code. > > I wish the Python compiler would adopt a strategy of bei

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2010-12-31 Thread Cesare Di Mauro
2010/12/31 > >>> Another example. I can totally remove the variable i, just using the >>> stack, so a debugger (or, in general, having the tracing enabled) > >> cannot even find something to change about it. > Ethan> -1 > >Ethan> Debugging is challenging enough as it is -- wh

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2010-12-31 Thread Cesare Di Mauro
2010/12/31 Ethan Furman > Cesare Di Mauro wrote: > > > > >> 2010/12/29 "Martin v. Löwis" wrote: >> > >> > >> Am 28.12.2010 18:08, schrieb Lukas Lueg: >>> >>>> Also, the load_fast in lne 22 to reference x could be

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2010-12-31 Thread Cesare Di Mauro
2010/12/31 Maciej Fijalkowski > On Fri, Dec 31, 2010 at 12:00 PM, Maciej Fijalkowski > wrote: > >> OK, but is it mandatory? For example, in the above code, I can unroll > the > >> loop because I found that range is the usual built-in, 5 is a low-enough > >> constant, > > > > How do you know xran

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2010-12-30 Thread Cesare Di Mauro
2010/12/29 "Martin v. Löwis" > Am 28.12.2010 18:08, schrieb Lukas Lueg: > > Also, the > > load_fast in lne 22 to reference x could be taken out of the loop as x > > will always point to the same object > > That's not true; a debugger may change the value of x. > > Regards, > Martin OK, but

Re: [Python-Dev] Possible optimization for LOAD_FAST ?

2010-12-30 Thread Cesare Di Mauro
2010/12/28 Lukas Lueg > Consider the following code: > > def foobar(x): >for i in range(5): >x[i] = i > > The bytecode in python 2.7 is the following: > > 2 0 SETUP_LOOP 30 (to 33) > 3 LOAD_GLOBAL 0 (range) > 6 LOAD_CONST

Re: [Python-Dev] mingw support?

2010-08-13 Thread Cesare Di Mauro
2010/8/13 Greg Ewing > Cesare Di Mauro wrote: > > You must suggest at least an equivalent "free" alternative to make the >> switch convenient. >> >> Otherwise we are talking about philosophy or religion, and nobody will >> change his ideas. >>

Re: [Python-Dev] mingw support?

2010-08-12 Thread Cesare Di Mauro
2010/8/12 > > On Thu, Aug 12, 2010 at 05:38:52PM +0900, David Cournapeau wrote: > > On Wed, Aug 11, 2010 at 10:21 PM, Sturla Molden > wrote: > > > > > > "David Cournapeau": > > >> Autotools only help for posix-like platforms. They are certainly a big > > >> hindrance on windows platform in gener

Re: [Python-Dev] Drive suffix

2010-08-04 Thread Cesare Di Mauro
2010/8/5 Greg Ewing > James Mills wrote: > >> Windows >> is one of the only Operating Systems with a File system that reuiqres >> this [A-Z]:\ syntax. >> > > There's also VMS, but it uses a colon too. Also its > pathnames are funky enough in other ways that it > needs its own os-specific pathname

Re: [Python-Dev] Python 3 optimizations...

2010-07-23 Thread Cesare Di Mauro
2010/7/23 stefan brunthaler > > This sounds like wpython (a CPython derivative with a wider set of byte > code > > commands) could benefit from it. > > > I am aware of the wpython project of Cesare di Mauro. wpython has reached 1.1 final version. If you are interest

Re: [Python-Dev] Python 3 optimizations...

2010-07-23 Thread Cesare Di Mauro
2010/7/23 Stefan Behnel > stefan brunthaler, 23.07.2010 08:48: > > If we take for instance the BINARY_ADD instruction, the interpreter >> evaluates the actual operand types and chooses the matching operation >> implementation at runtime, i.e., operands that are unicode strings >> will be concaten

Re: [Python-Dev] Can Python implementations reject semantically invalid expressions?

2010-07-02 Thread Cesare Di Mauro
; print 1/FOO > > cannot be rejected at compile time because there is insufficient > evidence that the value of FOO won't be changed before main() is > called. > > I even reject the substitution of "raise ZeroDivisionError" fo

Re: [Python-Dev] WPython 1.1 was released

2010-06-23 Thread Cesare Di Mauro
2010/6/23 Terry Reedy > On 6/23/2010 7:28 AM, Cesare Di Mauro wrote: > WPython is a CPython 2.6.4 implementation that uses "wordcodes" instead > of bytecodes. A wordcode is a word (16 bits, two bytes, in this case) > > I suggest you specify the base version (2.6.4) on

Re: [Python-Dev] WPython 1.1 was released

2010-06-23 Thread Cesare Di Mauro
2010/6/23 Steven D'Aprano > On Wed, 23 Jun 2010 08:12:36 pm Cesare Di Mauro wrote: > > I've released WPython 1.1, which brings many optimizations and > > refactorings. > > For those of us who don't know what WPython is, and are too lazy, too > busy, or

Re: [Python-Dev] Scope object (Re: nonlocals() function?)

2010-04-08 Thread Cesare Di Mauro
2010/4/7 Steven D'Aprano > On Tue, 6 Apr 2010 04:25:08 pm Cesare Di Mauro wrote: > > > It will certainly. There's MUCH that can be optimized to let CPython > > squeeze more performance from static analysis (even a gross one) on > > locals. > [...] > > T

Re: [Python-Dev] Scope object (Re: nonlocals() function?)

2010-04-06 Thread Cesare Di Mauro
2010/4/6 Greg Ewing > Cesare Di Mauro wrote: > > It will certainly. There's MUCH that can be optimized to let CPython >> squeeze more performance from static analysis (even a gross one) on locals. >> > > But can the existing locals() function be implemented in

Re: [Python-Dev] Scope object (Re: nonlocals() function?)

2010-04-05 Thread Cesare Di Mauro
2010/4/6 Antoine Pitrou > Greg Ewing canterbury.ac.nz> writes: > > > > Maybe it would be better to deprecate globals() and locals() > > and replace them with another function called something like > > scope(). > > It is useful to distinguish between globals (i.e., module-level variables) > and >

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-02-01 Thread Cesare Di Mauro
in object.c, dict.c, etc. A pluggable VM isn't feasible because we are talking about a brand new CPython (library included), to be chosen each time. If approved, this model will limit a lot the optimizations that can be implemented to make CPython running faster. Cesare Di Mauro

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-30 Thread Cesare Di Mauro
I'm back with some tests that I made with the U-S test suite. 2010/1/30 Scott Dial > > Cesare, just FYI, your Hg repository has lost the execute bits on some > files (namely "./configure" and "./Parser/asdl_c.py"), so it does not > quite build out-of-the-box. > Unfortunately, I haven't found a

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-29 Thread Cesare Di Mauro
2010/1/30 Scott Dial > > Cesare, just FYI, your Hg repository has lost the execute bits on some > files (namely "./configure" and "./Parser/asdl_c.py"), so it does not > quite build out-of-the-box. > That's probably because I worked on Windows. I have to address this issue. Thanks. > I took th

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-29 Thread Cesare Di Mauro
2010/1/30 > On 10:55 pm, collinwin...@google.com wrote: > >> >> That people are directly munging CPython >> bytecode means that CPython should provide a better, more abstract way >> to do the same thing that's more resistant to these kinds of changes. >> > > It might be helpful to hear more abou

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-29 Thread Cesare Di Mauro
2010/1/29 Antoine Pitrou > Actually, "wordcode" could allow accesses in the eval loop to be done on > aligned words, so as to fetch operands in one step on little-endian CPUs > (instead of recombining bytes manually). > > Regards > > Antoine. > I think that big-endians CPUs can get benefits too

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-29 Thread Cesare Di Mauro
I made a mistake talking about the example. Exchange binary operator and unary operator. Cesare 2010/1/29 Cesare Di Mauro > 2010/1/29 Nick Coghlan > > I wouldn't consider changing from bytecode to wordcode uncontroversial - >> the potential to have an effect on cache hit r

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-29 Thread Cesare Di Mauro
2010/1/29 Nick Coghlan > I wouldn't consider changing from bytecode to wordcode uncontroversial - > the potential to have an effect on cache hit ratios means it needs to be > benchmarked (the U-S performance tests should be helpful there). > It's quite strange, but from the tests made it seems t

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-29 Thread Cesare Di Mauro
2010/1/29 > > One strong suggestion for future releases: Please put a top-level directory > in your archives. It is annoying to expect that only to have an archive > expand into the current directory without creating a directory of its own. > I've been burned often enough that I always check be

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-29 Thread Cesare Di Mauro
2010/1/29 Antoine Pitrou > Cesare Di Mauro gmail.com> writes: > > > > If python dev community is interested, I can work on a 3.x branch, > porting > > all optimizations I made (and many others that I've planned to implement) > one > > step at the time,

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-29 Thread Cesare Di Mauro
2010/1/29 > >Cesare> ... (you can find the wpython 1.0 final here >Cesare> ). > > I tried downloading it. Something about wpython10.7z and wpython10_fix.7z. > What's a 7z file? What tool on my Mac will unpack that? Can I build and > ru

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-29 Thread Cesare Di Mauro
2010/1/29 > >Cesare> I think that wpython as a proof-of-concept have done its work, >Cesare> showing its potentials. > > If you haven't alreayd is there any chance you can run the Unladen Swallow > performance test suite and post the results? The code is separate from U-S > and should w

Re: [Python-Dev] default of returning None hurts performance?

2010-01-29 Thread Cesare Di Mauro
Hi Antoine, Wpython already addressed this with two new opcodes. RETURN_CONST constant_index which is an equivalent of: LOAD_CONST constant_index RETURN_VALUE and with: CALL_PROC_RETURN_CONST function_arguments, constant_index which is an equivalent of: CALL_FUNCTION function_arguments POP_

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-28 Thread Cesare Di Mauro
nge with expert people monitoring it. Cesare 2010/1/26 Collin Winter > Hi Cesare, > > On Tue, Jan 26, 2010 at 12:29 AM, Cesare Di Mauro > wrote: > > Hi Collin, > > > > One more question: is it easy to support more opcodes, or a different > opcode > > structu

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-26 Thread Cesare Di Mauro
Hi Skip For "relatively stable code" I talk about recent years. My experience with CPython is limited, of course. Cesare 2010/1/26 > >Cesare> ... but ceval.c has a relatively stable code ... > > I believe you are mistaken on several counts: > >* The names of the functions in there hav

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-26 Thread Cesare Di Mauro
Hi Collin, One more question: is it easy to support more opcodes, or a different opcode structure, in Unladen Swallow project? Thanks, Cesare ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscrib

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-26 Thread Cesare Di Mauro
Hi Collin, 2010/1/25 Collin Winter > Hi Cesare, > > On Sat, Jan 23, 2010 at 1:09 PM, Cesare Di Mauro > wrote: > > Hi Collin > > > > IMO it'll be better to make Unladen Swallow project a module, to be > > installed and used if needed, so demanding to u

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-24 Thread Cesare Di Mauro
2010/1/24 Floris Bruynooghe > Introducing C++ is a big step, but I disagree that it means C++ should > be allowed in the other CPython code. C++ can be problematic on more > obscure platforms (certainly when static initialisers are used) and > being able to build a python without C++ (no JIT/LLV

Re: [Python-Dev] PEP 3146: Merge Unladen Swallow into CPython

2010-01-23 Thread Cesare Di Mauro
Hi Collin IMO it'll be better to make Unladen Swallow project a module, to be installed and used if needed, so demanding to users the choice of having it or not. The same way psyco does, indeed. Nowadays it requires too much memory, longer loading time, and fat binaries for not-so-great performan

Re: [Python-Dev] wpython is back

2009-12-03 Thread Cesare Di Mauro
2009/11/27 Christian Heimes > Cesare Di Mauro wrote: > > > > You'll find some at page 28 > > here< > http://wpython.googlecode.com/files/Beyond%20Bytecode%20-%20A%20Wordcode-based%20Python.pdf > > > > .. > > > > Mart made more int

Re: [Python-Dev] wpython is back

2009-11-27 Thread Cesare Di Mauro
2009/11/27 Christian Heimes > Cesare Di Mauro wrote: > > > > You'll find some at page 28 > > here< > http://wpython.googlecode.com/files/Beyond%20Bytecode%20-%20A%20Wordcode-based%20Python.pdf > > > > .. > > > > Mart made more int

Re: [Python-Dev] wpython is back

2009-11-26 Thread Cesare Di Mauro
2009/11/27 Guido van Rossum > It's a Python implementation that uses wordcode instead of bytecode. > > http://code.google.com/p/wpython/ > > I don't see any benchmarks though. > You'll find some at page 28 here

[Python-Dev] wpython is back

2009-11-26 Thread Cesare Di Mauro
Hi Mart I'm back with some news about wpython. I completed all the work that I was committed to do till the end of the year. I made a lot of changes to the code, that I'll report here. First, I added several conditional compilation sections that enable or disable almost every optimization I intro

Re: [Python-Dev] A wordcode-based Python

2009-11-04 Thread Cesare Di Mauro
er I'll release wpython. I you have any questions, I'm at your disposal (thanks for your tests!) Cesare 2009/11/4 Mart Sõmermaa > On Tue, May 12, 2009 at 8:54 AM, Cesare Di Mauro > wrote: > >> Also, I checked out wpython at head to run Unladen Swallow's > &g

Re: [Python-Dev] special method lookup: how much do we care?

2009-05-13 Thread Cesare Di Mauro
On Sun, May 10, 2009 11:51PM, Nick Coghlan wrote: > However lots of developers rely on CPython ref counting as well, no > matter how many times they're told not to do that if they want to > support alternative interpreters. > > Cheers, > Nick. >From socket.py: # Wrapper around platform socket obj

Re: [Python-Dev] A wordcode-based Python

2009-05-12 Thread Cesare Di Mauro
On Tue, May 12, 2009 05:27 PM, Collin Winter wrote: > On Tue, May 12, 2009 at 4:45 AM, Cesare Di Mauro > wrote: >> Another note. Fredrik Johansson let me note just few minutes ago that >> I've >> compiled my sources without PGO optimizations enabled. >> >

Re: [Python-Dev] A wordcode-based Python

2009-05-12 Thread Cesare Di Mauro
On Thu, May 12, 2009 01:40PM, Antoine Pitrou wrote: > > Hi Cesare, > > Cesare Di Mauro a-tono.com> writes: >> >> It was my idea too, but first I need to take a deep look at what parts >> of code are changed from 2.6 to 3.0. >> That's because I d

Re: [Python-Dev] A wordcode-based Python

2009-05-11 Thread Cesare Di Mauro
Hi Collin On Mon, May 11, 2009 11:14PM, Collin Winter wrote: > Hi Cesare, > > On Mon, May 11, 2009 at 11:00 AM, Cesare Di Mauro > wrote: >> At the last PyCon3 at Italy I've presented a new Python implementation, >> which you'll find at http://code.google.com/p/

Re: [Python-Dev] A wordcode-based Python

2009-05-11 Thread Cesare Di Mauro
On Mon, May 11, 2009 10:27PM, Antoine Pitrou wrote: Hi Antoine > Hi, > >> WPython is a re-implementation of (some parts of) Python, which drops >> support for bytecode in favour of a wordcode-based model (where a is >> word >> is 16 bits wide). > > This is great! > Have you planned to port in to

[Python-Dev] A wordcode-based Python

2009-05-11 Thread Cesare Di Mauro
At the last PyCon3 at Italy I've presented a new Python implementation, which you'll find at http://code.google.com/p/wpython/ WPython is a re-implementation of (some parts of) Python, which drops support for bytecode in favour of a wordcode-based model (where a is word is 16 bits wide). It also

Re: [Python-Dev] pyc files, constant folding and borderline portability issues

2009-04-07 Thread Cesare Di Mauro
On Tue, Apr 7, 2009 07:22PM, Guido van Rossum wrote: >> In my experience it's better to discover a bug at compile time rather >> than >> at running time. > > That's my point though, which you seem to be ignoring: if the user > explicitly writes "1/0" it is not likely to be a bug. That's very > diff

Re: [Python-Dev] pyc files, constant folding and borderline portability issues

2009-04-07 Thread Cesare Di Mauro
time rather than at running time. Cesare > On Tue, Apr 7, 2009 at 8:19 AM, Cesare Di Mauro > wrote: >> In data 07 aprile 2009 alle ore 17:19:25, ha scritto: >> >>> >>>     Cesare> The only difference at this time is regards invalid >>>

Re: [Python-Dev] pyc files, constant folding and borderline portability issues

2009-04-07 Thread Cesare Di Mauro
In data 07 aprile 2009 alle ore 17:19:25, ha scritto: > > Cesare> The only difference at this time is regards invalid operations, > Cesare> which will raise exceptions at compile time, not at running > Cesare> time. > > Cesare> So if you write: > > Cesare> a = 1 / 0 > > Ce

Re: [Python-Dev] pyc files, constant folding and borderline portability issues

2009-04-07 Thread Cesare Di Mauro
On Apr 07, 2009 at 02:10AM, Steven D'Aprano wrote: > On the other hand, I'm with Guido when he wrote "it is certainly not > right to choose speed over correctness". This is especially a problem > for floating point optimizations, and I urge Cesare to be conservative > in any f.p. optimizations he

Re: [Python-Dev] pyc files, constant folding and borderline portability issues

2009-04-06 Thread Cesare Di Mauro
On Mon, Apr 6, 2009 18:57, s...@pobox.com wrote: > > Cesare> At this time with Python 2.6.1 we have these results: > Cesare> def f(): return 1 + 2 * 3 + 4j > ... > Cesare> def f(): return ['a', ('b', 'c')] * (1 + 2 * 3) > > Guido can certainly correct me if I'm wrong, but I believe

Re: [Python-Dev] pyc files, constant folding and borderline portability issues

2009-04-06 Thread Cesare Di Mauro
On Lun, Apr 6, 2009 16:43, Antoine Pitrou wrote: > Cesare Di Mauro a-tono.com> writes: >> def f(): return ['a', ('b', 'c')] * (1 + 2 * 3) > [...] >> >> With proper constant folding code, both functions can be reduced >> to a singl

Re: [Python-Dev] pyc files, constant folding and borderline portability issues

2009-04-06 Thread Cesare Di Mauro
On Mar 29, 2009 at 05:36PM, Guido van Rossum wrote: >> - Issue #5593: code like 1e16+2. is optimized away and its result stored >> as >> a constant (again), but the result can vary slightly depending on the >> internal >> FPU precision. > > I would just not bother constant folding involving

Re: [Python-Dev] test_io fails on test_1686475

2009-03-02 Thread Cesare Di Mauro
On Mar, 02 2009 at 00:13AM, Amaury Forgeot d'Arc wrote: > Hello, > > On Sun, Mar 1, 2009 at 23:04, Cesare Di Mauro > wrote: >> Running the test suite with Python 2.6.1 32 bit (compiled in DEBUG mode >> with Visual Studio Express Edition 2008) on Vista x64

[Python-Dev] test_io fails on test_1686475

2009-03-01 Thread Cesare Di Mauro
Running the test suite with Python 2.6.1 32 bit (compiled in DEBUG mode with Visual Studio Express Edition 2008) on Vista x64, I've got an assert error: test_1686475 (__main__.StatAttributeTests) ... Assertion failed: (__int64)(int)((in / 1000) - secs_between_epochs) == ((in / 1000) - secs

Re: [Python-Dev] Challenge: Please break this! [Now with blog post]

2009-02-24 Thread Cesare Di Mauro
On Feb, 24 2009 at 12:11PM, Antoine Pitrou wrote: > tav espians.com> writes: >> >> I've fixed this hole in safelite.py, but would be interested to know >> if there are other non-user-initiated dynamically imported modules? > > You'd better make __builtins__ read-only, it will plug a whole class

Re: [Python-Dev] Python-acceleration instructions on ARM

2009-02-11 Thread Cesare Di Mauro
Antoine Pitrou wrote: > Martin v. Löwis v.loewis.de> writes: >> - efficient array indexing: they give shift-and-index back to >> Thumb mode, for a shift by 2, allowing to index arrays with >> 4-byte elements in a single instruction (rather than requiring >> a separate multipy-by-four). Aga

Re: [Python-Dev] Python-acceleration instructions on ARM

2009-02-11 Thread Cesare Di Mauro
On Feb, 11 2009 at 04:11:AM, Benjamin M. Schwartz wrote: > Brett Cannon wrote: >> On Tue, Feb 10, 2009 at 18:45, Benjamin Schwartz >> wrote: >> > ... >>> According to ARM [4]: >>> >>> """Jazelle RCT can be used to significantly reduce the code bloat >>> associated >>> with AOT and JIT compilatio

Re: [Python-Dev] Expression optimizations

2009-02-10 Thread Cesare Di Mauro
On Mar, Feb 10, 2009 10:20PM, Raymond Hettinger wrote: > [Cesare Di Mauro] >> I'm playing with the virtual machine and I have some ideas about >> possibile >> optimizations that could be applyed. But I need to verify them, so >> understanding what is possible and wh

Re: [Python-Dev] Expression optimizations

2009-02-10 Thread Cesare Di Mauro
org > [mailto:python-dev-bounces+dinov=microsoft@python.org] On Behalf Of > Daniel Stutzbach > Sent: Tuesday, February 10, 2009 12:43 PM > To: cesare.dima...@a-tono.com > Cc: Python-Dev > Subject: Re: [Python-Dev] Expression optimizations > > On Tue, Feb 10, 2009 at 2:3

Re: [Python-Dev] Expression optimizations

2009-02-10 Thread Cesare Di Mauro
On Mar, Feb 10, 2009 09:42PM, Daniel Stutzbach wrote: > On Tue, Feb 10, 2009 at 2:36 PM, Cesare Di Mauro > wrote: > >> OK, so I can make assumptions only for built-in types. >> > > Yes, but even there you have to be careful of odd corner-cases, such as: > >>

Re: [Python-Dev] Expression optimizations

2009-02-10 Thread Cesare Di Mauro
On Mar, Feb 10, 2009 08:15 PM, Raymond Hettinger wrote: > > - Original Message - > From: "Cesare Di Mauro" > To: "Python-Dev" > Sent: Tuesday, February 10, 2009 8:24 AM > Subject: [Python-Dev] Expression optimizations > > >> In

Re: [Python-Dev] Expression optimizations

2009-02-10 Thread Cesare Di Mauro
On Mar, Feb 10, 2009 06:24 PM, Daniel Stutzbach wrote: > On Tue, Feb 10, 2009 at 11:16 AM, Steve Holden > wrote: > >> That's true, but the same *could* be said about the existing >> optimizations for objects that define their own __contains__. >> > > No, because there isn't a __not_contains__, so

Re: [Python-Dev] Expression optimizations

2009-02-10 Thread Cesare Di Mauro
On Mar, Feb 10, 2009 at 05:38 PM, Daniel Stutzbach wrote: > On Tue, Feb 10, 2009 at 10:24 AM, Cesare Di Mauro > > wrote: > >> Could it be applyable to other operations as well? So, if I wrote: >> c = not(a < b) >> the compiler and/or peephole optimizer can g

[Python-Dev] Expression optimizations

2009-02-10 Thread Cesare Di Mauro
In peephole.c I noticed some expression optimizations: /* not a is b --> a is not b not a in b --> a not in b not a is not b --> a is b not a not in b --> a

[Python-Dev] Why a STACKADJ(-1) in UNARY_NOT on ceval.c?

2009-02-05 Thread Cesare Di Mauro
Looking at the UNARY_NOT case in ceval.c: case UNARY_NOT: v = TOP(); err = PyObject_IsTrue(v); Py_DECREF(v); if (err == 0) { Py_INCREF(Py_True);

  1   2   >