`time' macro's "running stats for" can be misleading

Bug #190373 reported by Derick Eddington
2
Affects Status Importance Assigned to Milestone
Ikarus Scheme
Fix Committed
Low
Abdulaziz Ghuloum

Bug Description

`time' makes it look like (format A ~s B 123) was the timed expression, because `print-stats' uses "~a" for its format string and `time-macro' quotes the s-expression syntax. JTMI, if "~s" was used instead, the "running stats for" message for (time-it "Who Message" whatever) would look different -- maybe that's a reason to think of a solution other than just using "~s".

Ikarus Scheme version 0.0.3+ (revision 1372, build 2008-02-08)
Copyright (c) 2006-2008 Abdulaziz Ghuloum

> (time (format "A ~s B" 123))
running stats for (format A ~s B 123):
    no collections
    0 ms elapsed cpu time, including 0 ms collecting
    0 ms elapsed real time, including 0 ms collecting
    1504 bytes allocated
"A 123 B"
>

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Fixed in 1429. Thanks. You now get:

> (time (format "A ~s B" 123))
running stats for (format "A ~s B" 123):
    no collections
    0 ms elapsed cpu time, including 0 ms collecting
    0 ms elapsed real time, including 0 ms collecting
    1504 bytes allocated
"A 123 B"

Changed in ikarus:
assignee: nobody → aghuloum
status: New → Fix Committed
importance: Undecided → Low
Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

BTW, the solution was not to change the time-it procedure, but to change the time macro to construct the correct string:

--- scheme/psyntax.expander.ss 2008-03-16 01:00:16 +0000
+++ scheme/psyntax.expander.ss 2008-03-25 01:49:42 +0000
@@ -1301,7 +1301,11 @@
     (lambda (stx)
       (syntax-match stx ()
         ((_ expr)
- (bless `(time-it ',expr (lambda () ,expr)))))))
+ (let ([str
+ (let-values ([(p e) (open-string-output-port)])
+ (write (syntax->datum expr) p)
+ (e))])
+ (bless `(time-it ,str (lambda () ,expr))))))))

Changed in ikarus:
milestone: none → 0.0.4
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.