On Jun 23, Sam Tobin-Hochstadt wrote: > > Do we really want to remove contracts from code just because they > don't perform as well as hand-written checks?
The code in question is about 15 lines; at least I expect such code to run fast enough so I'll use it instead of writing my own 15 lines; the difference is huge (2.5 factor). > Also, did you try just changing the result contract from `void?' to > `any/c'? Did you? On Jun 24, Robby Findler wrote: > A factor of 4 for removing those contracts and turning them into > checks seems suspicious. They should not be that bad. Possibly Eli > made other changes in there too? The 4x factor is overall, mostly due to turning it from a double-linked list to single links. The contracts factor is still very high: about 2.5x. Specifically: No contracts (current version): cpu time: 10341 real time: 10344 gc time: 5156 Original contracts (and I removed the checks from the code): cpu time: 26205 real time: 26207 gc time: 7382 Same contracts but using any/c: cpu time: 25862 real time: 25865 gc time: 7338 Using queue/c instead of nonempty-queue/c (add a runtime check instead): cpu time: 24978 real time: 24981 gc time: 7157 Using the struct predicate directly instead of flat-named-contract: cpu time: 24838 real time: 24841 gc time: 7131 -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev