Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Dev

Re: Interest in integrating C decimal module into Python?

 

 

Python dev RSS feed   Index | Next | Previous | View Threaded


ncoghlan at gmail

Oct 21, 2009, 3:37 AM

Post #1 of 4 (422 views)
Permalink
Re: Interest in integrating C decimal module into Python?

Maciej Fijalkowski wrote:
> For example other python implementations might decide to use python
> version as long as builtin version does not appear. Python versions are
> usually also better targets for jit than mixed versions. C level versions also
> usually have more bugs (just statistics), so some people might want to
> choose pure-python version.
>
> In general - some people have some reasons.

Although nobody has broken "sys.modules['_decimal'] = 0", so
deliberately turning off optimisations is pretty easy if you really
don't want them.

There's a reason we moved to implicit import of optimised versions in
Py3k - we're unlikely to revert to the old way of doing things.

As far as decimal.py in particular goes, there are significant
maintenance gains in keeping a lot of the non-performance critical
context management code in pure Python. So we're likely to wait and see
how much speed Mark can wring out of a simple C decimal coefficient
object (that other implementations can also fairly easily provide
natively) before looking seriously at a wholesale replacement of the module.

Cheers,
Nick.

--
Nick Coghlan | ncoghlan [at] gmail | Brisbane, Australia
---------------------------------------------------------------
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


dickinsm at gmail

Oct 21, 2009, 7:59 AM

Post #2 of 4 (371 views)
Permalink
Re: Interest in integrating C decimal module into Python? [In reply to]

On Wed, Oct 21, 2009 at 11:37 AM, Nick Coghlan <ncoghlan [at] gmail> wrote:
> As far as decimal.py in particular goes, there are significant
> maintenance gains in keeping a lot of the non-performance critical
> context management code in pure Python. So we're likely to wait and see
> how much speed Mark can wring out of a simple C decimal coefficient
> object

No need to wait for this. :-) I don't really expect to get much speed gain
at all in normal, low-precision (= precisions less than 100 digits, say)
use. Even doubling the speed would be way too much to hope for here.

The only real gain from a decimal integer coefficient would be fixing
the asymptotics for high-precision calculations.

Mark
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


solipsis at pitrou

Oct 21, 2009, 8:05 AM

Post #3 of 4 (381 views)
Permalink
Re: Interest in integrating C decimal module into Python? [In reply to]

Mark Dickinson <dickinsm <at> gmail.com> writes:
>
> There are certainly some open issues (e.g., what to do with
> the existing Python module; what should other Python implementations
> do).

The existing module could be kept as a fallback. Also, the test suite should be
careful to test both implementations (like what is currently done for the io
module).

> BTW, does anyone know the current SLOC count for py3k?

Here you are, generated using David A. Wheeler's 'SLOCCount':

SLOC Directory SLOC-by-Language (Sorted)
261496 Lib python=261451,sh=45
186769 Modules ansic=173279,asm=9561,sh=3929
53258 Objects ansic=53258
40257 Python ansic=40229,python=28
27220 Tools python=27117,ansic=67,sh=36
18892 Demo python=18511,ansic=377,sh=4
9168 PC ansic=8465,python=703
5840 Include ansic=5840
5799 Parser ansic=3914,python=1885
3485 Misc lisp=2948,python=242,sh=185,ansic=110
3101 Doc python=2306,ansic=795
3030 Mac python=2138,objc=775,sh=109,ansic=8
1666 top_dir python=1140,ansic=286,sh=240
349 PCbuild python=279,ansic=70
337 build ansic=295,python=42
0 Grammar (none)

Totals grouped by language (dominant language first):
python: 315842 (50.89%)
ansic: 286993 (46.24%)
asm: 9561 (1.54%)
sh: 4548 (0.73%)
lisp: 2948 (0.47%)
objc: 775 (0.12%)

Total Physical Source Lines of Code (SLOC) = 620,667


_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


dickinsm at gmail

Oct 21, 2009, 8:28 AM

Post #4 of 4 (369 views)
Permalink
Re: Interest in integrating C decimal module into Python? [In reply to]

On Wed, Oct 21, 2009 at 4:05 PM, Antoine Pitrou <solipsis [at] pitrou> wrote:
> Mark Dickinson <dickinsm <at> gmail.com> writes:
>> BTW, does anyone know the current SLOC count for py3k?
>
> Here you are, generated using David A. Wheeler's 'SLOCCount':
> [...]

Thanks, Antoine! With SLOCCount I can revise my earlier numbers, as well:
Here's Stefan Krah's mpdecimal, version 0.80:

SLOC Directory SLOC-by-Language (Sorted)
21445 top_dir ansic=21267,sh=105,python=55,asm=18
6238 python python=6177,java=43,sh=18
1403 tests ansic=1356,sh=47
476 literature lisp=476
274 cmd ansic=274
11 tools sh=11
0 doc (none)

Totals grouped by language (dominant language first):
ansic: 22897 (76.71%)
python: 6232 (20.88%)
lisp: 476 (1.59%)
sh: 181 (0.61%)
java: 43 (0.14%)
asm: 18 (0.06%)


Lib/decimal.py:

SLOC Directory SLOC-by-Language (Sorted)
2636 tmp python=2636

Totals grouped by language (dominant language first):
python: 2636 (100.00%)

So it looks like 2636 lines of Python versus 21000-ish
lines of C.

Mark
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com

Python dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.