Opened 3 years ago

Closed 3 years ago

#27332 closed defect (fixed)

py3: Fix printing of microseconds in timeit

Reported by: slelievre Owned by:
Priority: trivial Milestone: sage-8.7
Component: python3 Keywords: py3, unicode
Cc: chapoton Merged in:
Authors: Jeroen Demeyer Reviewers: Samuel Lelièvre
Report Upstream: N/A Work issues:
Branch: d0de601 (Commits, GitHub, GitLab) Commit: d0de6010db59f108483ad99a0fc80055f1b27d43
Dependencies: Stopgaps:

Status badges

Description

Python3-based Sage prints µs for µs:

sage: timeit('factorial(999)')
625 loops, best of 3: 11 µs per loop

Not so in Python3-based Sage.

sage: timeit('factorial(999)')
625 loops, best of 3: 11 µs per loop

Observed in Sage 8.6 and 8.7.beta4, on macOS and Ubuntu.

The microsecond string "\xc2\xb5s" at lines 46 and 213 of the file src/sage/misc/sage_timeit.py needs py3 love.

    units = ["s", "ms", "\xc2\xb5s", "ns"]

Change History (6)

comment:1 follow-up: Changed 3 years ago by slelievre

  • Summary changed from Fix printing of microseconds in timeit to py3: Fix printing of microseconds in timeit

Is it just a matter of replacing "\xc2\xb5s" by u"\xc2\xb5s"?

comment:2 in reply to: ↑ 1 Changed 3 years ago by slelievre

Replying to slelievre:

Is it just a matter of replacing "\xc2\xb5s" by u"\xc2\xb5s"?

Tried that, no improvement. If not the string, then maybe one of

sage.misc.sage_timeit_class.sage_timeit.sage_timeit??
sage.misc.sage_timeit_class.sage_timeit.SageTimeitResult??

needs py3 love?

comment:3 Changed 3 years ago by jdemeyer

  • Branch set to u/jdemeyer/py3__fix_printing_of_microseconds_in_timeit

comment:4 Changed 3 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Commit set to d0de6010db59f108483ad99a0fc80055f1b27d43
  • Status changed from new to needs_review

New commits:

d0de601Fix unicode handling in timeit

comment:5 Changed 3 years ago by slelievre

  • Reviewers set to Samuel Lelièvre
  • Status changed from needs_review to positive_review

Thanks!

comment:6 Changed 3 years ago by vbraun

  • Branch changed from u/jdemeyer/py3__fix_printing_of_microseconds_in_timeit to d0de6010db59f108483ad99a0fc80055f1b27d43
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.