Re: Timing Curry programs

From: James Koppel <jkoppel_at_mit.edu>
Date: Fri, 20 Oct 2017 21:09:05 -0400

Thanks everyone for your help. I've successfully completed the first
benchmark.

My benchmark is a nondeterminism-heavy N-queens program. I found that KICS2
beat PAKCS by over an order of magnitude.

> I want to do this because, I have a new approach to implementing
> direct-style nondeterminism in imperative languages, and I'd like to
> compare to the "built-in" nondeterminism of Curry.
>
> Iā€™d be interested to hear about your results ; )


Paper should be on arXiv within a week. I'll send you a link when it is,
Sandra. :)

On Fri, Oct 20, 2017 at 4:13 AM, David Powers <david.powers_at_flinders.edu.au=
>
wrote:

> Here is the test.curry I use to test myriad sorting routines (first impor=
t
> includes mysort) on both pakcs and kics2.
> Note the $## for loop and the length print to force repetition/trick
> evaluation - for the lazy evaluation trap Michael refers to:
>
> import qsortsr
> import System
> import Random
>
> test = do
> time 10
> time 100
> time 1000
> time 10000
> time 100000
> time 1000000
>
> time n =
> let xs = take n (nextIntRange n 10000000)
> rep = 1000000 `div` n
> in do
> prin rep
> putStr " x "
> startc <- getCPUTime
> ys <- return $## for rep xs xs
> prin $ length ys -- lazy evaluation not done till forced
> endc <- getCPUTime
> putStr ": CPUTime "
> print $ endc-startc
>
> tests = do
> times 10
> times 100
> times 1000
> times 10000
> times 100000
> times 1000000
>
> times n =
> let xs = map show $ take n (nextIntRange n 10000000)
> rep = 1000000 `div` n
> in do
> prin rep
> putStr " x "
> startc <- getCPUTime
> ys <- return $## for rep xs xs
> prin $ length ys -- lazy evaluation not done till forced
> endc <- getCPUTime
> putStr ": CPUTime "
> print $ endc-startc
>
>
>
> prin t = putStr (show t)
>
> for n xs ys | n>0 = for (n-1) xs $## mysort xs
> | n==0 = ys
>
> --
> Prof. David M W Powers, Ph.D. Email: David.Powers_at_flinders.edu.a=
u
>
> Websites/Startups/Brands:
> http://flinders.edu.au/people/David.Powers
> http://david.wardpowers.info
> http://www.youramigo.com.au
> http://www.annacares.com.au
> http://www.clevertar.com.au
>
> *Professor of Computer Science & Cognitive Science, TON2.10*
> College of Science and Engineering (Phone:
> 08-8201 3663)
> Flinders University, Tonsley, South Australia 5042 (Fax: +61-8-8201
> 3626 <+61%208%208201%203626>)
> GPO Box 2100 Adelaide SA 5001 (Mobile/Viber:
> 0414-824-307)
> AUSTRALIA (Int'l
> Mobile: +372 571 64540)
>
> CRICOS Registered Provider: Flinders University | CRICOS Provider No:
> 00114A
>
>
>
>
>
>
>
>
> On 20 Oct 2017, at 6:32 pm, Michael Hanus <mh_at_informatik.uni-kiel.de>
> wrote:
>
> On 10/20/2017 12:15 AM, James Koppel wrote:
>
> (I do prefer an answer for KiCS2 over PAKCS, because I have the
> understanding that KiCS2 is faster.)
>
>
> You have to be careful. You are right that KiCS2 is generally faster,
> but this depends on the kind of applications. It is much faster for
> purely deterministic computations, but for non-deterministic computations
> it might not be the case. Since KiCS2 offer much more flexible
> evaluation strategies, this comes with some cost. There are cases
> where non-determinism is duplicated (due to the combination of laziness
> and non-determinism) so that you might get an exponential increase
> in some computations. See
>
> http://drops.dagstuhl.de/opus/volltexte/2012/3616/
>
> for a discussion (and partial solution).
>
> Best regards,
>
> Michael
>
> On Thu, Oct 19, 2017 at 6:15 PM, James Koppel <jkoppel_at_mit.edu
> <mailto:jkoppel_at_mit.edu>> wrote:
>
> How do time Curry programs? I'm looking through the KiCS2
> documentation, and I can't find any way to get the current system
> time (ifI want to time it internally), nor accept a command-line
> argument (if I want to use the time command).
>
> I want to do this because, I have a new approach to implementing
> direct-style nondeterminism in imperative languages, and I'd like to
> compare to the "built-in" nondeterminism of Curry.
>
> Sincerely,
> James Koppel
> MIT CSAIL
>
>
> _______________________________________________
> curry mailing list
> curry_at_lists.rwth-aachen.de
> https://mailman.rwth-aachen.de/mailman/listinfo/curry
>
>
>
> _______________________________________________
> curry mailing list
> curry_at_lists.rwth-aachen.de
> https://mailman.rwth-aachen.de/mailman/listinfo/curry
>



_______________________________________________
curry mailing list
curry_at_lists.rwth-aachen.de
https://mailman.rwth-aachen.de/mailman/listinfo/curry
Received on Sa Okt 21 2017 - 20:25:37 CEST

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:13 CEST