>> Of course Ben's hint at unsafe-reprovide is something I'd like to
>> investigate.
> 
> My hint turned into a PR and merged a few years ago.
> https://github.com/racket/typed-racket/pull/657
> 

I read that one yesterday - it does not address the issue fully. I meant
the hint at really implementing full (unsafe-reprovide ...) form.

> Here's the output I see from `typed-performance.rkt` . I'm on a commit
> from Jan 20. Does this look more like you'd expect?
> 
> ```
> ---
> typed: cpu time: 2990 real time: 3023 gc time: 65
> unsafe: cpu time: 405 real time: 408 gc time: 5
> typed, unsafe provided: cpu time: 692 real time: 697 gc time: 10
> plain: cpu time: 748 real time: 752 gc time: 3
> ---
> typed: cpu time: 2817 real time: 2825 gc time: 11
> unsafe: cpu time: 414 real time: 417 gc time: 3
> typed, unsafe provided: cpu time: 671 real time: 675 gc time: 4
> plain: cpu time: 750 real time: 754 gc time: 5
> ===
> ---
> typed: cpu time: 1678 real time: 1684 gc time: 0
> unsafe: cpu time: 161 real time: 165 gc time: 0
> typed, unsafe provided: cpu time: 175 real time: 178 gc time: 0
> plain: cpu time: 180 real time: 184 gc time: 0
> ---
> typed: cpu time: 1744 real time: 1755 gc time: 0
> unsafe: cpu time: 165 real time: 168 gc time: 0
> typed, unsafe provided: cpu time: 164 real time: 167 gc time: 0
> plain: cpu time: 195 real time: 198 gc time: 0
> ```
> 

No, this is still "wrong".

I experimented a bit with re-providing renamed / copied bindings as
discussed in those two issues and the results are definitely much
better. Almost perfect:


```
===rgb-average
---
typed: cpu time: 62 real time: 62 gc time: 10
typed-orig: cpu time: 1275 real time: 1275 gc time: 9
unsafe: cpu time: 50 real time: 50 gc time: 0
typed, unsafe provided: cpu time: 271 real time: 271 gc time: 0
plain: cpu time: 416 real time: 416 gc time: 0
---
typed: cpu time: 54 real time: 54 gc time: 1
typed-orig: cpu time: 1273 real time: 1273 gc time: 2
unsafe: cpu time: 49 real time: 49 gc time: 0
typed, unsafe provided: cpu time: 271 real time: 271 gc time: 0
plain: cpu time: 414 real time: 414 gc time: 0
===rgb-distance^2
---
typed: cpu time: 672 real time: 672 gc time: 1
typed-orig: cpu time: 664 real time: 664 gc time: 1
unsafe: cpu time: 12 real time: 12 gc time: 0
typed, unsafe provided: cpu time: 13 real time: 13 gc time: 0
plain: cpu time: 13 real time: 13 gc time: 0
---
typed: cpu time: 676 real time: 676 gc time: 1
typed-orig: cpu time: 664 real time: 664 gc time: 1
unsafe: cpu time: 13 real time: 13 gc time: 0
typed, unsafe provided: cpu time: 13 real time: 13 gc time: 0
plain: cpu time: 13 real time: 13 gc time: 0
```

Now the "typed" version of "rgb-average" is almost on par with usafe
one. I re-provided only rgb-average, I left rgb-distance intact. Also I
optimized it a bit (basically restructured the way the bindings are
introduced in the loop) and that helped a lot. But now...

Why is the re-provided through rename of copied binding (typed) 5 times
faster than the one which is unsafe-provide'd (typed, unsafe provided)
directly? I must be overlooking something.


Cheers,
Dominik

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/427cc569-1929-d70c-3d0d-894de2b89176%40trustica.cz.

Reply via email to