This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients kristjan.jonsson, larry, loewis, pitrou, serhiy.storchaka, vajrasky, vstinner
Date 2014-01-28.11:34:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390908883.29.0.136463507827.issue20416@psf.upfronthosting.co.za>
In-reply-to
Content
> Did you tested for numerous shared int and floats? [1000] * 1000000 and [1000.0] * 1000000? AFAIK this was important use cases for adding 3 or 4 versions.

Here are new benchmarks on Python 3.4 with:

    Integers: [1000] * 1000000
    Floats: [1000.0] * 1000000

Integers, without the patch:

    dumps v3: 62.8 ms
    data size v3: 4882.8 kB
    loads v3: 10.7 ms

Integers, with the patch:

    dumps v3: 18.6 ms (-70%)
    data size v3: 4882.8 kB (same size)
    loads v3: 27.7 ms (+158%)

Floats, without the patch:

    dumps v3: 62.5 ms
    data size v3: 4882.8 kB
    loads v3: 11.0 ms

Floats, with the patch:

    dumps v3: 29.3 ms (-53%)
    data size v3: 8789.1 kB (+80%)
    loads v3: 25.5 ms (+132%)

The version 3 was added by:
---
changeset:   82816:01372117a5b4
user:        Kristján Valur Jónsson <sweskman@gmail.com>
date:        Tue Mar 19 18:02:10 2013 -0700
files:       Doc/library/marshal.rst Include/marshal.h Lib/test/test_marshal.py Misc/NEWS Python/marshal.c
description:
Issue #16475: Support object instancing, recursion and interned strings in marshal
---

This issue tells about "sharing string constants, common tuples, even common code objects", not sharing numbers.

For real data, here are interesting numbers:
http://bugs.python.org/issue16475#msg176013

Integers only represent 4.8% of serialized data, and only 8.2% of these integers can be shared. (Floats represent 0.29%.) Whereas strings repsent 58% and 57% can be shared.
History
Date User Action Args
2014-01-28 11:34:43vstinnersetrecipients: + vstinner, loewis, pitrou, kristjan.jonsson, larry, serhiy.storchaka, vajrasky
2014-01-28 11:34:43vstinnersetmessageid: <1390908883.29.0.136463507827.issue20416@psf.upfronthosting.co.za>
2014-01-28 11:34:43vstinnerlinkissue20416 messages
2014-01-28 11:34:42vstinnercreate