00:26
bigboote has quit [Read error: 110 (Connection timed out)]
00:32
jourdechance has quit ["Leaving"]
00:50
monochrom has quit ["Few people understand "understanding"."]
00:52
smkl_ has joined #ocaml
01:01
smt has joined #ocaml
01:02
mfurr has quit ["Client Exiting"]
01:05
<
smt >
I just wrote my second OCaml program, and what else could it be than one that prints fibonacci numbers. even the bytecode version ran really fast, but when compiled to native code it ran faster than exactly the same program written in C (and compiled with -O2)
01:05
<
smt >
does OCaml optimize the recursion somehow? does it even remove it completely?
01:06
<
grirgz >
look to the asm code :p
01:07
<
smt >
not gonna do that :)
01:07
<
smt >
19308 lines of asm :P
01:08
<
det >
smt, O'caml optimizes tail recursion
01:08
<
grirgz >
just for a fibonacci function ?
01:08
<
det >
smt, I think the labels in the asm correspond to the function
01:09
<
smt >
det, hmm... but IIRC gcc should do that as well with -O2, no?
01:09
<
det >
It is very hard to do tail call optmization in C
01:09
<
det >
but for some simple cases, GCC will do it
01:09
<
smt >
fibonacci should be simple enough...
01:09
<
det >
what defintion?
01:10
<
smt >
what you mean?
01:10
<
det >
The naive implementation is not tail recursive AFAIK
01:10
<
smt >
if (n < 2) return 1; return fib(n-1) + fib(n-2);
01:10
<
det >
Is your implementation short, can you paste it (less than 4 lines or so)
01:11
<
det >
That is not tail recursive
01:11
<
smt >
and the ocaml version: if n < 2 then 1 else fib(n-1) + fib(n-2);;
01:11
<
det >
yeah, that is the naive implementation
01:11
<
smt >
yup, the school book version :)
01:11
<
det >
O'caml can't optimize the recursion away
01:13
<
smt >
hmm... how come it's faster than the C version? need to put less stuff in stack then?
01:13
<
det >
tail recursion (A special case of a tail call) is when the last thing you do is call yourself
01:13
<
det >
in that example the last thing being done is (ignoring the decieving infix syntax) +
01:14
<
smt >
hmm.. ah, indeed, the last thing I do here is sum up
01:14
<
smt >
anyway, I use the same (poor) algorithm in the C and O'caml versions
01:14
<
det >
I am not familiar witht he implementation of O'caml
01:14
<
det >
But I guess that is just something it excells at
01:15
<
det >
I am sure C will be happy to tear apart O'caml in many other examples :)
01:16
<
smt >
of course. I was just wondering what it optimizes here
01:17
xqw has joined #ocaml
01:18
<
det >
smt, compare the asm
01:20
<
smt >
I'm not
_that_ interested in it that I'd look at gcc optimized asm, which is a mess
01:20
<
smt >
I'll rather spend the time learning more O'caml
01:21
<
det >
It would certainly taken less time than you spent here :)
01:23
cmeme has quit [Read error: 54 (Connection reset by peer)]
01:23
<
mlh >
C would use more stack, no?
01:23
cognominal has quit [Read error: 60 (Operation timed out)]
01:27
<
smt >
and at the ocaml "about the program" is this: NOT ACCEPTED: Program not recursive.
01:28
<
det >
ugh, I just tried to do C-x 2 in firefox
01:29
<
smt >
however, when I look at the asm of the ocaml version it looks like the recursion is still there
01:29
<
smt >
too much emacs for you
01:30
<
det >
I think that is from an older version of O'caml
01:30
<
det >
erm, old version of the O'caml fibo entry
01:30
<
det >
"The OCaml fibonacci entry is incorrect. It uses an iterative loop to
01:30
<
det >
compute the fibonacci numbers, while the test requires the usual naive
01:30
<
det >
recursive approach. It is pretty clear that something is wrong from
01:30
<
det >
looking at the timing table, which shows OCaml as 30 times faster than
01:30
<
det >
the next best language."
01:31
<
smt >
ah, so they've fixed the ocaml version but forgot the old remark there
01:50
humasect has quit [Read error: 60 (Operation timed out)]
02:33
CosmicRay has joined #ocaml
02:49
smkl_ has quit [Read error: 110 (Connection timed out)]
02:52
cmeme has joined #ocaml
03:42
smkl_ has joined #ocaml
03:46
CosmicRay has quit ["Client exiting"]
03:50
anyone has joined #ocaml
04:13
<
det >
anyone, You are a often sought after person
04:13
<
det >
anyone, people are constantly joining to ask if "Anyone is here"
04:13
<
anyone >
my intention to play with them.
04:24
mfurr has joined #ocaml
05:06
cjohnson has quit [Read error: 104 (Connection reset by peer)]
05:24
smkl_ has quit [Read error: 110 (Connection timed out)]
06:10
mlh has quit [Client Quit]
06:20
mfurr has quit ["sleep"]
06:26
zzorn has joined #ocaml
06:36
smkl_ has joined #ocaml
06:38
anyone has quit ["Few people understand understanding."]
06:58
__DL__ has joined #ocaml
07:28
grirgz_ has joined #ocaml
07:37
a-zwei has joined #ocaml
07:39
grirgz has quit [Read error: 104 (Connection reset by peer)]
07:40
a-zwei has left #ocaml []
07:42
a-zwei has joined #ocaml
07:54
Msandin has joined #ocaml
07:55
Submarine has joined #ocaml
08:05
a-zwei has quit [Read error: 104 (Connection reset by peer)]
08:10
a-zwei has joined #ocaml
08:11
a-zwei has quit [Client Quit]
08:17
humasect has joined #ocaml
08:44
vezenchio has quit ["We learn from history that we learn nothing from history"]
08:44
vezenchio has joined #ocaml
08:45
pango has quit [Remote closed the connection]
08:51
solarwind has quit ["leaving"]
09:06
pango has joined #ocaml
09:08
* vincenz
smacks det
09:20
Submarine has quit ["Leaving"]
10:05
Submarine has joined #ocaml
10:22
smkl_ has quit [Read error: 110 (Connection timed out)]
10:32
mlh has joined #ocaml
11:05
Submarine has quit ["Leaving"]
11:40
Banana has quit [Read error: 60 (Operation timed out)]
11:43
smkl_ has joined #ocaml
12:33
Submarine has joined #ocaml
12:34
mlh has quit [Client Quit]
12:46
cjohnson has joined #ocaml
12:54
smkl_ has quit [Read error: 60 (Operation timed out)]
13:07
_JusSx_ has joined #ocaml
13:18
_JusSx_ has quit ["leaving"]
13:29
vezenchio has quit ["We learn from history that we learn nothing from history"]
13:38
vodka-goo has joined #ocaml
13:49
grirgz_ is now known as grirgz
13:50
smimou has joined #ocaml
13:56
smkl_ has joined #ocaml
14:15
mfurr has joined #ocaml
14:30
CosmicRay has joined #ocaml
14:34
cognominal has joined #ocaml
14:44
Yorick has joined #ocaml
14:47
a-zwei has joined #ocaml
15:34
mattam has joined #ocaml
15:41
cognominal has quit [Read error: 60 (Operation timed out)]
15:50
smkl_ has quit [Read error: 110 (Connection timed out)]
16:03
cognominal has joined #ocaml
16:16
zzorn is now known as zzorn_afk
16:17
slashvar[lri] has quit [Remote closed the connection]
16:20
slashvar[lri] has joined #ocaml
16:30
mfurr has quit [Remote closed the connection]
16:35
Msandin has quit [Read error: 110 (Connection timed out)]
16:43
smkl_ has joined #ocaml
16:46
_fab has quit [Remote closed the connection]
17:06
Yorick has left #ocaml []
17:10
Snark has joined #ocaml
18:14
mrvn_ has joined #ocaml
18:21
Submarine has quit ["Leaving"]
18:23
xerox has quit [Read error: 104 (Connection reset by peer)]
18:24
mrvn has quit [Read error: 110 (Connection timed out)]
18:31
smkl_ has quit [Read error: 110 (Connection timed out)]
18:42
pango has quit ["Leaving"]
18:54
Submarine has joined #ocaml
18:59
cognominal has quit [Read error: 60 (Operation timed out)]
19:01
xol has joined #ocaml
19:02
cjohnson has quit [Read error: 60 (Operation timed out)]
19:18
cognominal has joined #ocaml
19:18
_fab has joined #ocaml
19:23
smkl_ has joined #ocaml
19:28
cognominal has quit [Read error: 54 (Connection reset by peer)]
19:28
cognominal has joined #ocaml
19:29
grirgz has quit [Read error: 104 (Connection reset by peer)]
20:03
cognominal has quit [Read error: 54 (Connection reset by peer)]
20:04
cognominal has joined #ocaml
20:11
Snark has quit ["Leaving"]
20:16
Zaius has joined #ocaml
20:21
smkl_ has quit [Read error: 110 (Connection timed out)]
20:25
smimram has joined #ocaml
20:26
smimou has quit [Read error: 113 (No route to host)]
21:01
picard has quit ["Leaving"]
21:03
smimou has joined #ocaml
21:07
monochrom has joined #ocaml
21:13
smimram has quit [Read error: 113 (No route to host)]
21:19
xol has quit [Read error: 104 (Connection reset by peer)]
21:29
Submarine has quit ["Leaving"]
21:43
smkl_ has joined #ocaml
21:46
gim_ has joined #ocaml
21:47
mrpingoo has joined #ocaml
21:49
pingouin has joined #ocaml
21:50
vodka-goo has quit [Read error: 60 (Operation timed out)]
21:52
gim has quit [Read error: 60 (Operation timed out)]
22:02
Smerdyakov has quit [Read error: 110 (Connection timed out)]
22:05
gim_ has quit [Read error: 113 (No route to host)]
22:06
gim_ has joined #ocaml
22:06
mrpingoo has quit [Read error: 110 (Connection timed out)]
22:08
pingouin is now known as vodka-goo
22:13
zzorn_afk has quit ["They are coming to take me away, ha ha"]
22:31
__DL__ has quit [Remote closed the connection]
22:34
CosmicRay has quit ["Client exiting"]
22:37
KrispyKringle has quit ["Changing server"]
22:38
KrispyKringle has joined #ocaml
22:42
mlh has joined #ocaml
22:50
Banana has joined #ocaml
23:27
mattam has quit ["zZz"]
23:35
smkl_ has quit [Read error: 60 (Operation timed out)]
23:48
vincenz has quit ["leaving"]