uwplse / syncro

Synthesis of Incremental Operations
2 stars 1 forks source link

coerce-evaluate causes slow printing #11

Closed Sumith1896 closed 7 years ago

Sumith1896 commented 7 years ago

num2helper prints code very slowly. My initial hunch is that this is due to multiple calls coerce-evaluate (particularly symbolics) in that. This can be seen from the trace:

  context...:
   /usr/local/share/racket/collects/racket/list.rkt:435:28: loop
   [repeats 305 more times]
   /home/sumith1896/uwplse/rosette/rosette/base/core/reflect.rkt:22:9: loop
   /usr/local/share/racket/collects/racket/list.rkt:583:2: append-map
   /home/sumith1896/uwplse/rosette/rosette/base/core/reflect.rkt:22:9: loop
   /usr/local/share/racket/collects/racket/list.rkt:583:2: append-map
   parse-loop88
   /home/sumith1896/uwplse/rosette/rosette/base/core/reflect.rkt:22:9: loop
   /usr/local/share/racket/collects/racket/list.rkt:583:2: append-map
   /home/sumith1896/uwplse/rosette/rosette/base/core/reflect.rkt:22:9: loop
   /usr/local/share/racket/collects/racket/list.rkt:583:2: append-map
   parse-loop88
   /home/sumith1896/uwplse/rosette/rosette/base/core/reflect.rkt:22:9: loop
   /usr/local/share/racket/collects/racket/list.rkt:583:2: append-map
   /home/sumith1896/uwplse/rosette/rosette/base/core/reflect.rkt:22:9: loop
   /usr/local/share/racket/collects/racket/private/map.rkt:25:19: loop
   ...

Can we write coerce-evaluate better than this?

(define (coerce-evaluate thing model)
  (define sym-map    
    (make-hash 
      (map (lambda (sym) (cons sym sym)) (symbolics thing))))    
  (evaluate thing (complete model sym-map)))
rohinmshah commented 7 years ago

Ah, that's annoying, that's a Rosette function. It's using a lot of append, which takes linear time, so symbolics then becomes quadratic, which is the issue here. While we could rewrite coerce-evaluate, the better solution is to just improve symbolics in Rosette -- I've submitted a PR to Rosette (https://github.com/emina/rosette/pull/59), once that's accepted this problem should go away.

Sumith1896 commented 7 years ago

I think we are good here now, closing if no objections.