Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Would having (optional) type annotation, or even a relatively coercitive type system help much in the way of performance? Admittedly, this wouldn't be scheme anymore, but are there example of this done in the wild with profitable impact? E.g. even as an extension to RXRS.

I'd guess if you're sure your `fib` function handles only integers, you should get a lot of easy inlining/specialization at your disposition.



It helps. Chicken seems to support exactly that: https://wiki.call-cc.org/man/5/Types

Chez instead provides typed/unchecked arithmetic functions, like fx+, flround and so on. In my experience, those sometimes make a big impact on performance(though realistically in some of those cases it would be better to ask C to do it for you).

Racket similarly makes it possible to do either.


Chicken supports fx+ and flround as well, as do all R6RS and R7RS-large systems.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: