gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
ski has quit [Ping timeout: 265 seconds]
cdidd has quit [Remote host closed the connection]
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 260 seconds]
ulfdoz_ is now known as ulfdoz
ski has joined #ocaml
ski has quit [Client Quit]
ski has joined #ocaml
hyperboreean has quit [Ping timeout: 260 seconds]
hyperboreean has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
milosn_ has joined #ocaml
milosn has quit [Ping timeout: 276 seconds]
hyperboreean has quit [Ping timeout: 246 seconds]
Tobu has joined #ocaml
hyperboreean has joined #ocaml
milosn has joined #ocaml
milosn_ has quit [Ping timeout: 260 seconds]
mnabil has quit [Remote host closed the connection]
Tobu has quit [Ping timeout: 260 seconds]
Tobu has joined #ocaml
avsm has quit [Quit: Leaving.]
smerz has quit [Remote host closed the connection]
lamawithonel has quit []
lamawithonel has joined #ocaml
lamawithonel has quit [Client Quit]
lamawithonel has joined #ocaml
alvis has quit [Ping timeout: 245 seconds]
lamawithonel has quit []
lamawithonel has joined #ocaml
lamawithonel has quit [Client Quit]
lamawithonel has joined #ocaml
lamawithonel has quit []
lamawithonel has joined #ocaml
hexreel has joined #ocaml
lamawithonel has quit [Client Quit]
lamawithonel has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
Tobu has quit [Ping timeout: 260 seconds]
milosn_ has joined #ocaml
milosn has quit [Ping timeout: 260 seconds]
lihaitao has joined #ocaml
Tobu has joined #ocaml
NamelessOne has quit [Quit: Bye all, see you next time!]
milosn_ has quit [Ping timeout: 240 seconds]
cdidd has joined #ocaml
testcocoon has quit [Quit: Coyote finally caught me]
ggherdov has joined #ocaml
glguy has left #ocaml []
pango is now known as pangoafk
Tobu has quit [Ping timeout: 260 seconds]
Tobu has joined #ocaml
Xizor has joined #ocaml
testcocoon has joined #ocaml
ftrvxmtrx_ has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
mika1 has joined #ocaml
cago has joined #ocaml
djcoin has joined #ocaml
eni has joined #ocaml
silver_ has joined #ocaml
ggherdov has quit [Remote host closed the connection]
ftrvxmtrx has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
yezariaely has joined #ocaml
<eni> The method sum has type
<eni> (< get : number; get_float : float; .. > as 'a) -> unit
<eni> where 'a is unbound
<eni> what does this kind of error mean?
<Ptival> if the method has to be polymorphic, then the class has to be polymorphic, otherwise the method has to be monomorphic, it seems
<Ptival> or maybe you need a 'a.
<eni> well in my cae it's polymorphic, but i don't see why it's causing an error.
<eni> i'm doing a match ... in the body of my method so that shouldn't be a problem
<Ptival> did you quantify over 'a in the type signature of the method?
<eni> Ptival, no
<eni> wait i'll paste the code
<eni> it's not polymorphic in fact*
<eni> it can only have the type number.
<flux> eni, you should do this: object (_ : 'this) = .. method sum (o : 'this) = ..
<flux> eni, the thing is that as you've written, any object that has method #get and #get_float and any other methods is ok as an argument
<flux> that is, nothing says it should be a 'number'
<flux> but that's so polymorphic that it would need a forall quantifier to actually work
<eni> well the match says it.
<flux> match says that?
<eni> everything that is Int, Real is a number.
<eni> so every object that has #get and returns a number..
<eni> no?
<flux> it was never a question of what o#get returns
<flux> that much is clear from the error message that it knows it :)
<flux> the problem is that '..'
<flux> alternative fix: method sum (o : <get : number; get_float : float>) = ..
<flux> alternative fix2: method sum : 'a. <get : number; get_float : float; ..> as 'a = ..
<flux> (not sure if that works)
<flux> oops, it doesn't, make that " = .." to "-> _ = fun o ->"
<eni> the 'fix'and the one mentioned above don't work.
<flux> well I should try it then :).
<eni> the 'fix' tells me | Int x -> (match value with
<eni> ^^^^^
<eni> Error: This pattern matches values of type number
<eni> but a pattern was expected which matches values of type number
<eni> #
<eni> the ^^ point to Int x
<Ptival> funny error message :)
<eni> yeah
<eni> logicians should love ocaml.
<flux> eni, btw, what is get_float? you have method get_real?
<flux> some other class?
ankit9 has joined #ocaml
<flux> this works: http://pastebin.com/z4xEaC75
<flux> note I renamed class number to be number2, otherwise it cannot be compiled into a module
<eni> no it's the same, i forgot to rename it
<eni> oh, that was the problem flux
<eni> the fact that it was number twice.
<flux> this works as well: http://pastebin.com/hmFmf1jb
<flux> and this is the polymorphic version: http://pastebin.com/b08MqNit
<eni> method sum : 'a. (<get : number; get_real : float; ..> as 'a) -> _ = fun o -> what does the _ represent in this line?
<eni> the return of sum?
<flux> yes
<flux> I left it blank as it's inferred, but you could of course put the type into it
<adrien> The Return Of Sum - Starring Xavier Leroy and Jacques Garrigues
<eni> :p
<adrien> (sorry :p)
<eni> should i do explicitly define anything to use self in my code?
<flux> eni, you mean self the object?
<eni> yes
<eni> (this in java0
<flux> object (this) .. - this now referes to the this-object as in Java
<flux> btw, this is nice because you can have object literals and you still get to refer to any unshadowed 'this'
<flux> (ie. an embedded object might use this2)
<eni> cool
Tobu has quit [Ping timeout: 260 seconds]
<flux> also, be aware that many (including myself) consider object oriented OCaml to be an advanced subject. it might not be the first way people consider of when trying to accomplish a goal, but rather that's used if the problem calls for it.
<flux> of course that's not a reason to avoid it, you should study it as it's great :)
<eni> i just did this to see how objects really work, it was my first time writing a class in ocaml
<eni> usually i go for java/cpp/python to write oo code
<flux> things that usually require a class and inheritance in other language can sometimes be expressed as a class type and an object literal. object factories can often be simply be functions returned from other functions. some food for thought ;)
<mrvn> inheritance can be done with first class modules now.
ankit9 has quit [Read error: Connection reset by peer]
ankit9 has joined #ocaml
jamii has joined #ocaml
<flux> really? have an example of that? because when I was trying to find one, I noticed in the end they still made use of objects inside..
<flux> (or records of functions)
<mrvn> flux: The module is a record of functions internally.
<flux> does that mean we shouldn't use modules because records will do? or that we shouldn't use objects because modules will do?
<flux> (modules have the benefit of containing types and constructors, though)
<mrvn> The advantage of a module over an explicit record is that you can include a module in another and add more functions and still pass it to something expecting the base module.
<mrvn> And the advantage of objects is that you don't have to pass the module and self explicitly.
<mrvn> In mostcases it is just a matter of taste.
avsm has joined #ocaml
avsm has quit [Client Quit]
<eni> modules have the benefit of containing constructors?
<yezariaely> ist there an easy way to map a string character by character?
<mrvn> eni: constructors as in multiple.
<yezariaely> e.g. s.th. like String.map?
<mrvn> let map s f = let len = String.length s in let t = String.create len in for i = 0 to len - 1 do t.[i] <- f s.[i]; done; t
ankit9 has quit [Ping timeout: 276 seconds]
<yezariaely> mrvn: thanks, sure I could write that, however the output should not be a string. At the moment I use a reference combined with String.iter to get the characters out.
<yezariaely> was wondering if there is a more elegant way.
<yezariaely> anyway thx
<mrvn> yezariaely: what do you mean? map functions usualy return the same general type as the input.
<mrvn> do you mean String.fold?
<yezariaely> mrvn: I know, however here, I have to take a string and return a list of constructor types
<yezariaely> (the characters only surrounded by a constructor)
<yezariaely> i.e. I have to represent a string as a list of characters
<yezariaely> but thanks for your example, I learnt about the "<-" operator. I did not see this one before ;-)
<mrvn> # let explode s = let rec loop acc = function 0 -> s.[0]::acc | i -> loop (s.[i]::acc) (i-1) in loop [] (String.length s - 1);;
<mrvn> val explode : string -> char list = <fun>
<mrvn> List.map f (explode s)
<Ptival> yezariaely: it's just String.set
<yezariaely> Ptival: how would String.set be helpful if I have a string and want it to convert it to a list of MyChars ?
<Ptival> just use explode
<yezariaely> thx to all of you
<mrvn> It sucks that ocamls stdlib doesn't have String.to_list and String.of_list
<yezariaely> yes it does
<Ptival> ocaml's stdlib is really "the ocaml compiler's library"
<Ptival> so yes, some stuff that would be useful is not there because it is not necessary inside the compiler and would add on the maintenance burden
<Ptival> that's why you have stdlib efforts such as JaneStreet's core or Batteries Included
Tobu has joined #ocaml
<Ptival> the fact that there is more than one is, somehow, kinda unfortunate
<Drakken> How are you supposed to feed object files for syntax extensions to camlp4 when you use it as a -pp preprocessor to ocamlc?
avsm has joined #ocaml
<Drakken> -or- how do you use a command with arguments as the -pp arg of ocamlc?
<Ptival> ocamlc -I +camlp4 -pp "camlp4of /path/to/foo.cm(a/o)" blarg.cma bla.ml
<Ptival> something along these lines should work
ankit9 has joined #ocaml
<djcoin> mrvn: your implementation of expode will fail with an empty sting
<djcoin> string*
<djcoin> explode*
<djcoin> erf
<mrvn> right, -1 -> acc | i->...
alvis has joined #ocaml
<Ptival> just use the one in the link I pasted :)
jamii has quit [Ping timeout: 245 seconds]
comak has quit [Remote host closed the connection]
larhat has quit [Quit: Leaving.]
avsm has quit [Quit: Leaving.]
jamii has joined #ocaml
avsm has joined #ocaml
ankit9 has quit [Ping timeout: 265 seconds]
cyphase has quit [Ping timeout: 246 seconds]
cyphase has joined #ocaml
err404 has joined #ocaml
ankit9 has joined #ocaml
Ptival has quit [Quit: leaving]
Ptival has joined #ocaml
ViciousPlant has quit [Ping timeout: 276 seconds]
ViciousPlant has joined #ocaml
larhat has joined #ocaml
milosn has joined #ocaml
ankit9 has quit [Ping timeout: 276 seconds]
_andre has joined #ocaml
ViciousPlant has quit [Ping timeout: 265 seconds]
ViciousPlant has joined #ocaml
ankit9 has joined #ocaml
lihaitao has quit [Quit: Ex-Chat]
bacam has quit [Read error: Operation timed out]
yroeht has quit [Ping timeout: 245 seconds]
yroeht has joined #ocaml
ViciousPlant has quit [Ping timeout: 245 seconds]
bacam has joined #ocaml
ViciousPlant has joined #ocaml
jamii has quit [Ping timeout: 264 seconds]
Tobu has quit [Ping timeout: 272 seconds]
ViciousPlant has quit [Ping timeout: 276 seconds]
Tobu has joined #ocaml
ViciousPlant has joined #ocaml
RichN has joined #ocaml
ViciousPlant has quit [Ping timeout: 245 seconds]
ViciousPlant has joined #ocaml
snearch has joined #ocaml
<RichN> I'm having problems building cryptokit, but I don't think it's due to cryptokit itself.
<RichN> The library seems to build correctly, but then it tries to build the test program. I get this:
<RichN> ocamlfind ocamlc -g -custom -I src -linkpkg -package unix -package num src/cryptokit.cma test/test.cmo -o test/test.byte
<RichN> ld: cannot find -lcamlrun -lcurses
<RichN> File "_none_", line 1, characters 0-1:
<RichN> Error: Error while building custom runtime system
<RichN> Maybe I'll try the mailing list...
RichN has quit [Quit: Gotta go!]
<adrien> no idea; try without -custom
<eni> is a match expensive?
fabjan_ is now known as fabjan
ankit9 has quit [Ping timeout: 276 seconds]
<adrien> no
<adrien> can you somehow read ASM? (no need to be proficient)
<eni> ASM?
<adrien> assembly
<Ptival> assembly
<eni> i never compile ocaml code in fact.
<eni> i just use the toplevel.
<eni> s/never/almost never/
<adrien> the efficiency will be slightly different but it'll give you an idea anyway
<adrien> if you call ocamlopt with -S, it'll keep a .s file with the assembly code the .ml file
<eni> i was just curious because i found 2 soulutions to a problem, and one of them has pattern matching and the other doesn't.. so i was curious to predict which one would be faster before implementing both of them.
<adrien> and reading it (even quickly) will show how some things are done
<adrien> make a file with "match Some 42 with | None -> () | Some _ -> ()", ocamlopt -S -c thatfile.ml
<adrien> it's also interesting to see with: "let Some x = Some 42"
<adrien> (the pattern-matching is non-exhaustive; that has an influence on the code)
lorilan has joined #ocaml
<Ptival> eni: how does the other deal with what the pattern-match does?
<eni> mod 2
<adrien> and what does the pattern-matching one does?
<eni> one (pattern matchin) passes the parity as arguments and uses the fact that even+even = even, even+odd|odd+even = odd, odd+odd=even, and the other does a mod 2 for every num, etc.
<eni> it seems obvious though that passing an argument to a function is less expensive than doing a mod 2
<Ptival> you could use two auxiliary functions that assume the parity for even faster :)
<eni> (the number of fun calls is the same)
Kakadu has joined #ocaml
<eni> Ptival, you mean two mutual recursive functions?
<Ptival> yes
<eni> so having 3, False ; 5, False ; to calculate if 8 (3+5) is even, it would be faster to call (even(8)) than to do match ... False, False -> (3+5), true ?
<Ptival> or maybe you'd lose speed for lack of tailcallness :\
<Ptival> dunno
<eni> i'll just measure the execution times for big big numbers
<eni> and will loop lots of times to see if the difference exists or no.
<adrien> and I guess that land (logical and) would be fasterer
<Ptival> fasterer++zomg!!1!1!
<eni> :)
<Ptival> that's as fast as you can get
<adrien> that was because of the lag: I wasn't sure I had typed the "er"; but I had
<adrien> :-)
<Ptival> (then you need quantum computers)
<eni> i once used a benchmark library don't remember what..
<Ptival> (and the HH was meant to be sent to your other nazi-adorating channel? :d)
<Ptival> damn you lag!
<adrien> 'H' is for the control character saying "delete the char"
avsm has quit [Quit: Leaving.]
<adrien> land should be roughly twice faster as mod
<adrien> for bytecode
Tobu has quit [Ping timeout: 272 seconds]
* Ptival is printing these right now
<eni> i tattooed them on my thigh
Tobu has joined #ocaml
<eni> like memento
<Ptival> I won't visit you when you're coding then :)
<eni> haha
emmanuelux has joined #ocaml
<eni> what about these two http://pastebin.com/4SXMVTT0 ?
err404 has quit [Remote host closed the connection]
<djcoin> eni: isn't it the ( = ) operator restricted to boolean types ?
<djcoin> let f1 (o1:bool) (o2:bool) = o1 = o2;;
<eni> yes
<eni> i was just asking about the execution difference
<djcoin> Oh, all right
<djcoin> Sorry :)
<adrien> hmm
<thelema> eni: what execution difference?
<thelema> one of them is a pattern match, and the other is a nested boolean expression.
<eni> if you call f1 N times and f2 N times, which will finish faster?
<thelema> f1
<eni> what if f2 = o1 = o2 (like djcoin said)
<thelema> f2 is not optimized; you say to do `and` and `or`, the compiler does wht you say
<thelema> if you have f3 as djcoin, it'll be faster than f1
<eni> ok
<thelema> without the type annotations, probably slower.
<thelema> wow, I take that back.
<thelema> I'm not sure I understand these results, but here they are...
<Ptival> http://ocaml.xelpaste.org/4833 I have no idea whether this is relevant :D
<thelema> and this is why we benchmark.
* thelema needs to look at the assembly
<thelema> f2 (1.23 ns) is 94.8% faster than
<thelema> f1 (23.43 ns) which is 62.1% faster than
<thelema> f3 (61.83 ns)
<adrien> also, please use || and &
<adrien> also, please use || and &&
<djcoin> weird
<adrien> nor "or" and "&"
<adrien> or you'll get spanked :-)
<Ptival> thelema is so deprecated
<Ptival> some SO post mentioned that annotating compare did not result in a better code
<eni> wait, so the f3 is slower than f2 AND f1?
<adrien> thelema: and can't you run 10000 times more iterations?
<thelema> adrien: it takes 1/3 second for all my tests; 10K times longer would take hours
<adrien> 100 times more then?
<adrien> I had thought it too a coupel ms instead
<djcoin> I can not understand how a ( = ) is slower
<djcoin> == would be even faster
<djcoin> less slower :s
<adrien> dump the assembly
<djcoin> maybe
<thelema> assembly dumped in same gist
<djcoin> not much time on my hands unfortunatly :\
<eni> thelema, can you add a f4 with || and && ?
<djcoin> unfortunately **
<adrien> thelema: hmmm, I can't see it
<adrien> ah =)
<thelema> adrien: sorry, problems submitting first time
<thelema> eni: sure, no problem
<adrien> movqcaml_equal@GOTPCREL(%rip), %rax
<adrien> callcaml_c_call@PLT
<adrien> in f3
<thelema> yup, calling subroutine. surprised that wasn't inlined
<adrien> for f1, I wonder if | true, true | false, false -> true | _ -> false, wouldn't be faster
<adrien> (have to afk)
<thelema> adrien: unlikely, pattern matching is heavily optimized
<thelema> it should be optimal in this case
<pippijn> I'm unhappy with inlining of "function"
<adrien> hmmm, right, it doesn't check tuples as tuples but as several match-with
<pippijn> let f = function A -> (function A -> ())
<eni> what does that subroutine mean?
jamii has joined #ocaml
<mrvn> eni: some helper C function the compiler doesn't generate inline.
avsm has joined #ocaml
<eni> so to see if 1 bit is equal with 1 bit it calls something extra?
<thelema> https://gist.github.com/2398889 <- with f4
<adrien> (hmmm, makes me wonder if == wouldn't be faster actually)
<adrien> eni: it's the generic comparison function; it's _generic_
<thelema> adrien: == is faster
<adrien> the question is why does ocaml need to use the generic one; maybe because comparison wouldn't be the "best" way to do it anyway and it's not deemed to be a worthy optimization in the compiler
<adrien> (why make X faster when Y is much much much faster anyway and does the same)
<eni> still not as fast as f2
<adrien> thelema: thanks :-)
<mrvn> adrien: = should be fast
<thelema> adrien: ocaml has an optimized = for ints, maybe it doesn't use the same one for bools
<thelema> (even though it should)
<adrien> I don't think it'll be easy to beat f2; as far as I'm concerned, I consider this to be the simplest and most-straightforward way to do the function
<mrvn> = for ints is inlined
<eni> thelema, can you add a f2bis where or is replaced by || and & by && ?
<thelema> eni: yes, already written
<adrien> I think it's really going to be hard to find something faster; even in C/assembly
<eni> thelema, ah, i didn't see it in the last link..
<thelema> eni: not uploaded yet; about to run the benchmark
<mrvn> adrien: a simple xor would be better
<eni> that should be the fastest according to what you guys were saying
<thelema> I'm trying to figure out where the logic went in the f2 solution... The assembly has subq, but no and/or
<mrvn> let f5 (o1:bool) o2 = not (o1 != o2)
<thelema> gist updated with f5 = f2 with && and ||; same result as f2
<thelema> mrvn: that will be f6
<mrvn> It's strange that != is inlined but = is not
<thelema> != is opposite of ==
<djcoin> mrvn: != is the contrary of ==
<djcoin> yep
<djcoin> <> if opposite of =
<mrvn> ahh, I forgot. <> then.
<pippijn> mrvn: != is physical identity
<mrvn> damn, <> is a callq too.
<pippijn> maybe <> is also inlined if both arguments are known to be int
<pippijn> or bool
<djcoin> Can you specify which fun you want to inline ?
<djcoin> (I saw that on f#)
<mrvn> djcoin: this isn't inline. it depends on wether the compiler has MM code for it or not.
<thelema> djcoin: no, ocaml's inliner doesn't let the user pick
<djcoin> ok
<eni> thelema, the benchmark is in fact running these in the toplevel right?
<mrvn> It looks to me like = and <> lack the MM code sniplets for bools. With int it doesn't use callq.
<thelema> eni: no, as native compiled code
<eni> ok.
<thelema> mrvn: that's what I'm benchmarking now.
<adrien> mrvn: agreed: xor would probably be faster but not _that_ much and then you wouldn't get any faster
<mrvn> adrien: one opcodes instead of 4
<thelema> mrvn: opcodes don't matter too much, micro-opts matter
<thelema> s/opts/ops/
<mrvn> Is there a way to specify ((o1 & o2) or ((not o1) & (not o2))) without lazy evaluation?
<thelema> land, lor
<thelema> but that's for ints
<mrvn> thelema: so Obj.magic them to int?
<thelema> sure.
<thelema> my final version is uploaded to the same gist. apparently not even int = is faster than what ocamlopt comes up with for the long boolean expression
<eni> time to play Tupac - Changes (that's just the way it is.. things will never be the same) :p
<djcoin> lol
<mrvn> actually scratch that, lnot doesn't do: http://paste.debian.net/163407/
<djcoin> Do you know some documentation, papers or tutorials to dive into ocaml internals ? (compilation, Obj.Magic etc. ?)
<mrvn> It really is too bad there isn't a syntax to write embedded MM code in ocaml.
<thelema> djcoin: rwmjones wrote some nice blog posts about ocaml internals
<mrvn> Why can't ocaml work with untagged integers as intermediate results?
<thelema> gc might run?
<djcoin> Indeed ! I saw its post a few weeks ago. I have to read them for good
<mrvn> thelema: not in 1 - (i1 lxor i2)
<thelema> extra bookkeeping to make sure everything is acceptable before gc
<mrvn> It tags (i1 lxor i2), then it subs 0x3 and tags that again.
mika1 has quit [Remote host closed the connection]
mika1 has joined #ocaml
<mrvn> Would be better to sub 0x2
Kakadu has quit [Quit: Page closed]
<thelema> threading?
<mrvn> thelema: since when is ocamls threading preemptive?
<hcarty> mrvn: Since when is it not?
<mrvn> hcarty: since ever. you need to release the runtime lock for other threads to run.
<hcarty> mrvn: Doesn't OCaml manage that unless you're calling out to C?
<mrvn> hcarty: iirc the GC does it when it gets called.
<mrvn> But you don't get thread switches in the middle of an expression that doesn't call the GC.
<thelema> in bytecode, yes. in native code, iirc, ocaml has two threading models, and system threads are preemptive
<thelema> oops, bytecode has the two threading models, native has only system threads
<mrvn> thelema: the system threads are, but all but one is blocked aquireing the runtime lock.
<thelema> ah.. .hmmm
snearch has quit [Quit: Verlassend]
<mrvn> To test try to write some ocaml code that runs a long time without invoking the GC.
<thelema> yes, I've heard of that problem, requiring a call to Thread.yield()
<mrvn> It it where truely preemptive the thread switch could happen between an integer opreation that destroys the tag and the operation restoring the tag. And then the GC could thing the register holds a pointer.
<thelema> yes, that's what I've been trying to work out, I guess all the extra safety isn't needed
<thelema> but I guess that the optimizer only works at the level before tags are introduced
<thelema> and the last codegen phase is pretty dumb about re-tagging
<mrvn> Its odd, tagging should be like boxing and the compiler knows how to unbox some stuff.
<thelema> I'd guess that boxing is taken care of at a different level than tagging
lorilan has quit [Quit: Quitte]
<mrvn> 1 - (i1 lxor i2) also shows that ocaml doesn't do register allocation properly. There is a needless move from one register to the other in there.
<thelema> I thought ocaml did graph coloring for register allocation... unless you're using that linear scan branch that came out...
<thelema> I guess that even the graph coloring algorithm takes some shortcuts
<mrvn> thelema: why doesn't it "xor %rax,%rbx" and use %rbx instead of $rdi for the rest?
<thelema> mrvn: I see. I don't know.
<mrvn> 1 - (i2 lxor i1) does.
<mrvn> Does it lack the knowledge that xor a,b == xor b,a?
<thelema> just knowing that doesn't enable it to apply that rule everywhere to see if that would improve the output.
<mrvn> true, it has to combine that with register allocation
landonf has left #ocaml []
cago has quit [Quit: Leaving.]
mika1 has quit [Remote host closed the connection]
<mrvn> I also wonder how much one would gain from optimizing the asm output. Ocaml doesn't seem to interleave operations.
<mrvn> e.g. mov $0x3,%rax could be before or $0x1,%rdi
<mrvn> or does modern cpu pipelining reorder that internally enough that it doesn't matter?
<pippijn> mrvn: I think it will
<mrvn> What I always find most interesting is that despide everything ocaml DOESN't do it generaly runs no worse than twice as long as c.
<mrvn> and often nearly the same.
<pippijn> reducing polymorphism helps a lot, too
<pippijn> in this case, you already did that
<mrvn> pippijn: you mean let f x y = x = y vs. let f (x:int) y = x = y?
<pippijn> yes
<pippijn> or involving <
lorilan has joined #ocaml
<mrvn> I'm not sure that actualy helps so much in real live. Such simple functions do get inlined and then it usualy knows the type. Doesn't the inlined version then automatically loose the polymorphism?
<pippijn> I don't think so
<mrvn> let f1 x y = x = y let f2 (x:int) y = x = y let f3 (x:int) y = f1 x y
<mrvn> f1 uses callq as it must, f2 uses inlined = and f3 callq again. :(
emmanuelux has quit [Remote host closed the connection]
<mrvn> pippijn: that seems rather stupid. Lossing the polymorphism is a huge speed up and the optimizer/inliner should figure that out.
<pippijn> yeah
<mrvn> I mistakenly thought the inliner would be higher up and the polymorphism thingy would be during code generation.
<mrvn> Seems like the type information isn't updated when inlining or something.
<hcarty> mrvn: Thanks for the GC clarifications.
<thelema> OCaml's inliner is certainly a weak point of its implementation, and could definitely be improved
<hcarty> mrvn: Regarding inlining and polymorphism I think there is a bug report or few about that
<hcarty> With some activity recently if I recall correctly
<thelema> hcarty: the ocamlpro folks were working on inlining; I'm not sure how far they were able to get
<thelema> I just want inlining of functions passed as parameters.
<mrvn> thelema: That kind of is reverse inlining. :)
maufred has quit [Ping timeout: 260 seconds]
maufred has joined #ocaml
<mrvn> thelema: does inlining work with functors (e.g. does it inline the compare function in a Set)?
rby_ has quit [Quit: leaving]
lorilan has quit [Remote host closed the connection]
yezariaely has quit [Quit: leaving]
lorilan has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
larhat has quit [Quit: Leaving.]
err404 has joined #ocaml
rwmjones has quit [Ping timeout: 265 seconds]
<mfp> mrvn: no, calls to functions in the module parameter always go through the internal record-like structure
smerz has joined #ocaml
emmanuelux has joined #ocaml
rwmjones has joined #ocaml
letrec has joined #ocaml
andreypopp has joined #ocaml
avsm has quit [Quit: Leaving.]
<eni> when using = is there a memory read?
datkin has quit [Ping timeout: 244 seconds]
<thelema> eni: ?? depends on whether the values being (=)'ed are in registers or not. Most likely, yes, there is a memory read
<eni> thelema, that's why the or /not version was faster i think.
<thelema> umm, it would need to do the same amount of memory read as (=)
<thelema> mrvn: exactly - I want to give my code in a reverse-inlined manner and have the compiler inline it for performance.
<Ptival> scandal: Bob Harper wrote O'Caml!!!
<thelema> mrvn: as to functors, it can't inline the compare function in Set, as this functor isn't applied until runtime.
<thelema> Ptival: Bob Harper wrote some OCaml code which he compiled with the INRIA OCaml compiler? or he wrote some code that's part of the OCaml compiler?
<Ptival> thelema: haha, I actually meant that he wrote "O'Caml" instead of "OCaml" in his presentation at Milner Symposium :D
<thelema> oh. Maybe he was referring to the irish cousin of OCaml.
<thelema> or maybe the proper spelling of OCaml has been unclearly communicated.
avsm has joined #ocaml
jonafan_ is now known as jonafan
rossberg has quit [Ping timeout: 272 seconds]
rossberg has joined #ocaml
eni has quit [Quit: Leaving]
djcoin has quit [Quit: WeeChat 0.3.2]
letrec has quit [Ping timeout: 272 seconds]
jamii has quit [Read error: No route to host]
avsm has quit [Quit: Leaving.]
<hcarty> thelema: That's why the name was changed - Ireland kept getting all the credit :-)
Zedrikov has joined #ocaml
Zedrikov is now known as NamelessOne
Zedrikov has joined #ocaml
Zedrikov has quit [Read error: Connection reset by peer]
Zedrikov has joined #ocaml
pangoafk is now known as pango
yroeht has quit [Ping timeout: 265 seconds]
yroeht has joined #ocaml
jamii has joined #ocaml
jamii has quit [Ping timeout: 245 seconds]
<Drakken> Ptival sorry about that dumb question this morning. What I really needed to ask about is ocamlbuild.
<thelema> I just caught the end of the Milner Symposium webcast; is anyone recording it?
<Drakken> Compound prepreprocessing commands work with ocamlc, but I'm having trouble using them with ocamlbuild.
<Drakken> i.e. [ocamlc -pp "camlp4 foo.cmo" bar.ml] works, but [ocamlbuild bar.byte] fails with [<bar.ml>: pp("camlp4 foo.cmo")] in _tags.
<thelema> Drakken: what command does ocamlbuild produce?
<Drakken> Thank you.
<Drakken> Apparently the quotation marks are redundant.
jamii has joined #ocaml
<Drakken> And ocamlbuild cds into _build, so foo.cmo needs a "../" in front of it.
<thelema> Drakken: if possible, you should copy/build foo.cmo in _build
<Drakken> without the quotation marks :)
<thelema> :)
<Drakken> thelema actually, the file is ../foo/foo.ml. It's a utility.
<Drakken> So from _build it's ../../foo/foo.ml :)
<thelema> and why isn't it built by ocamlbuild?
<thelema> oh, it's outside your source tree
<Drakken> right
<thelema> so why isn't it installed somewhere?
<Drakken> I guess it should be.
<Drakken> I just haven't gotten around to it.
<Drakken> I mean foo.cmo, not foo.ml
Anarchos has joined #ocaml
ftrvxmtrx has joined #ocaml
sivoais has quit [Quit: leaving]
sivoais has joined #ocaml
sivoais has quit [Quit: Lost terminal]
avsm has joined #ocaml
sivoais has joined #ocaml
sivoais has quit [Client Quit]
sivoais has joined #ocaml
_andre has quit [Quit: leaving]
larhat has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
<flux> is there a nicer way to go through two floating pointer values than: (1.0, 10.0) --. y_dim |> BatEnum.iter **> fun y -> (1.0, 10.0) --. x_dim |> BatEnum.iter **> fun x -> ..
<pippijn> go through?
<flux> as in operate on points (1.0, 1.0); (11.0, 1.0); (21.0, 1.0) .. (1.0, 11.0); (11.0, 11.0); ..
landonf has joined #ocaml
landonf has left #ocaml []
Tobu has joined #ocaml
<pippijn> I don't know these operators
<pippijn> and I don't really like using lots of custom operators
<adrien> :-)
andreypopp has quit [Quit: Computer has gone to sleep.]
snearch has joined #ocaml
oriba has joined #ocaml
err404 has quit [Remote host closed the connection]
wtetzner has joined #ocaml
tufisi has quit [Ping timeout: 276 seconds]
wtetzner has quit [Remote host closed the connection]
wtetzner has joined #ocaml
Zedrikov has quit [Quit: Bye all, see you next time!]
NamelessOne has quit [Quit: Bye all, see you next time!]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
jamii has quit [Ping timeout: 252 seconds]
jamii has joined #ocaml
jamii has quit [Read error: Connection reset by peer]
Xizor has quit [Ping timeout: 260 seconds]
snearch has quit [Quit: Verlassend]
zorun has quit [Read error: Connection reset by peer]
zorun has joined #ocaml
letrec has joined #ocaml
cyphase has quit [Ping timeout: 265 seconds]
datkin has joined #ocaml