[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2015-05-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Are there tests for all the "builtin scalars"? Yes, now there are. -- assignee: -> serhiy.storchaka resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.5 -Python 3.4

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2015-05-16 Thread Roundup Robot
Roundup Robot added the comment: New changeset c77a42c234d6 by Serhiy Storchaka in branch 'default': Issue #18682: Optimized pprint functions for builtin scalar types. https://hg.python.org/cpython/rev/c77a42c234d6 -- nosy: +python-dev ___ Python trac

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-09-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: To made some sense in Python 3 context we should remove the check for the locale module and replace repr() by ascii(). -- ___ Python tracker

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-09-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Are there tests for all the "builtin scalars"? -- ___ Python tracker ___ ___ Python-bugs-list mailin

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-09-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Antoine, what you say? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-15 Thread Michal Vyskocil
Michal Vyskocil added the comment: The fast scalars approach looks great! -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch which adds fast path for builtin scalar types. Or we can just remove a special case for strings. -- Added file: http://bugs.python.org/file31292/pprint_safe_repr_scalars.patch ___ Python tracker

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: We can just remove "if typ is str:" case at all. A general case works for strings. But for performance (this will slowdown Antoine's tests by 15-20%) we should left it and may be even extend it to other builtin types: builtin_type = (str, int, float, NoneTy

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ran some benchmark numbers: $ ./python -m timeit -s "from pprint import saferepr; s='é\"x' * 1000" "saferepr(s)" -> before patch: 555 usec per loop -> after patch: 10.9 usec per loop $ ./python -m timeit -s "from pprint import saferepr; s='xxx' * 1000" "safer

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-08 Thread Michal Vyskocil
Changes by Michal Vyskocil : Added file: http://bugs.python.org/file31194/check.py ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-08 Thread Michal Vyskocil
Michal Vyskocil added the comment: This is simple code checks if .isalnum is or is not locale sensitive and a small measurement of how much is the repr faster, compared to old codepath. BTW: python3 test_pprint.py on patched version have succeeded OK (expected failures=1) --

[issue18682] [PATCH] remove bogus codepath from pprint._safe_repr

2013-08-08 Thread Michal Vyskocil
New submission from Michal Vyskocil: pprint._safe_repr for type str uses much slower codepath by default, which does not makes a sense in Python3 context. Instead of simply using repr, it check the existence of 'locale' in sys.modules and if found, it goes one-by-one-char call str.isalpha() on