small improvements to the memory usage for files opened in DrRacket.
Before this commit, opening collects/drracket/private/unit.rkt required about 17.5 megabytes of memory and after this commit, it is down to about 15 megabytes. The precise measurement I did was to create a frame and a scheme:text% object in it, record the result of current-memory-use, open the file, and record current-memory-use again. For comparison, using a text:standard-style-list% object instead of the scheme:text% requires only about 4.1 megabytes. One difference being that there are about 3x more snips (10,204 vs 33,901 (after the commit)), since we have one snip for each region that has a different color in the scheme:text version, and the text:standard-style-list has no colors and thus about two per line (there are 5006 lines in the file). original commit: a7cb8fdc84f3b592c812468e5e7486d4f7d5bbb6
This commit is contained in:
parent
618ab0567b
commit
2da0f72492
|
@ -30,7 +30,7 @@ added get-regions
|
||||||
(init-depend framework:text^ framework:mode^)
|
(init-depend framework:text^ framework:mode^)
|
||||||
|
|
||||||
(define (should-color-type? type)
|
(define (should-color-type? type)
|
||||||
(not (memq type '(white-space no-color))))
|
(not (memq type '(no-color))))
|
||||||
|
|
||||||
(define (make-data type mode backup-delta)
|
(define (make-data type mode backup-delta)
|
||||||
(if (zero? backup-delta)
|
(if (zero? backup-delta)
|
||||||
|
|
|
@ -328,7 +328,10 @@
|
||||||
[(sexp-comment) 'comment]
|
[(sexp-comment) 'comment]
|
||||||
[else sym]))
|
[else sym]))
|
||||||
(define sn-hash (make-hasheq))
|
(define sn-hash (make-hasheq))
|
||||||
(define (short-sym->style-name sym)
|
(define (short-sym->style-name _sym)
|
||||||
|
(define sym (if (eq? _sym 'white-space)
|
||||||
|
'parenthesis
|
||||||
|
_sym))
|
||||||
(hash-ref sn-hash sym
|
(hash-ref sn-hash sym
|
||||||
(λ ()
|
(λ ()
|
||||||
(let ([s (format "framework:syntax-color:scheme:~a"
|
(let ([s (format "framework:syntax-color:scheme:~a"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user