[ prog / sol / mona ]

prog


How can I run my own instance of this

112 2020-03-03 11:35

[2/2]

$ mit-scheme --load test.scm 
MIT/GNU Scheme running under GNU/Linux
Type `^C' (control-C) followed by `H' to obtain information about interrupts.

Copyright (C) 2011 Massachusetts Institute of Technology
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Image saved on Tuesday February 6, 2018 at 6:31:25 PM
  Release 9.1.1     || Microcode 15.3 || Runtime 15.7 || SF 4.41
  LIAR/x86-64 4.118 || Edwin 3.116
;Loading "test.scm"... done

[...]

1 ]=> (timeit (lambda () (posts-range (stress 20))))
.02 0. .025
;Value 16: (1 2 3 [...] 300)

1 ]=> (timeit (lambda () (posts-range64 (stress 20))))
0. 0. 0.
;Value 17: #(#f #t #t [...] #t)

[...]

1 ]=> (timeit (lambda () (posts-range (stress 182))))
.15 .18 .328
;Value 23: (1 2 3 [...] 300)

1 ]=> (timeit (lambda () (posts-range64 (stress 182))))
.01 .01 .018
;Value 24: #(#f #t #t [...] #t)

1 ]=> (timeit (lambda () (posts-range (stress 183))))
;Aborting!: out of memory
;GC #45: took:   0.20 (100%) CPU time,   0.10 (100%) real time; free: 16769613
;GC #46: took:   0.10 (100%) CPU time,   0.10  (93%) real time; free: 16769646

1 ]=> (timeit (lambda () (posts-range64 (stress 183))))
.01 0. .017
;Value 25: #(#f #t #t [...] #t)

I guess speeding up your code by a factor of 10+ and no longer breaking the memory limit just doesn't appeal to some people.

301


VIP:

do not edit these