Report optimizations and missed optimizations with the DrRacket tool.

Currently, that just means showing the text that would be shown on the
command line. Eventually, it should highlight code in the editor, and
have tooltips explaining what happened.
This commit is contained in:
Vincent St-Amour 2011-06-22 19:12:03 -04:00
parent a71a45e41f
commit 27f3eb3870

View File

@ -1,8 +1,11 @@
#lang racket/base
(require racket/unit racket/class
(require racket/unit racket/class racket/port
racket/gui/base mrlib/switchable-button)
(require (prefix-in tr: typed-scheme/typed-reader)
typed-scheme/optimizer/logging)
(provide performance-report-drracket-button)
;; DrRacket tool for reporting missed optimizations in the editor.
@ -20,10 +23,25 @@
(send bdc set-bitmap #f)
bmp))
;; performance-report-callback : drracket:unit:frame<%> -> void
(define (performance-report-callback drr-frame)
(define defs (send drr-frame get-definitions-text)) ; : text%
(define portname (send defs get-filename))
(message-box
"Performance Report"
(with-output-to-string
(lambda ()
(with-tr-logging-to-port
(current-output-port)
(lambda ()
(parameterize ([current-namespace (make-base-namespace)]
[read-accept-reader #t])
(expand
(tr:read-syntax portname
(open-input-string (send defs get-text)))))))))))
(define performance-report-drracket-button
(list
"Performance Report"
reverse-content-bitmap
(λ (drs-frame)
(message-box "Performance Report"
"Coming Soon!"))))
performance-report-callback))