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
<hcarty> thelema: I think it did change some number of months ago
<hcarty> thelema: The forge SSH key
<hcarty> thelema: But I'm not certain about that
ulfdoz_ has joined #ocaml
emmanuelux has quit [Ping timeout: 244 seconds]
ulfdoz has quit [Ping timeout: 276 seconds]
ulfdoz_ is now known as ulfdoz
Arsenik has quit [Ping timeout: 244 seconds]
Cyanure has quit [Ping timeout: 276 seconds]
avsm has quit [Quit: Leaving.]
shaleh has joined #ocaml
shaleh has quit [Client Quit]
lopex has quit []
tautologico has joined #ocaml
sebz has joined #ocaml
mjonsson has quit [Remote host closed the connection]
sebz has quit [Quit: Computer has gone to sleep.]
dnolen has joined #ocaml
Skolem has joined #ocaml
seafood has quit [Quit: seafood]
sebz has joined #ocaml
sebz has quit [Client Quit]
dnolen has quit [Quit: dnolen]
tautologico has quit [Quit: tautologico]
Skolem has quit [Quit: Skolem]
Skolem has joined #ocaml
Snark_ has joined #ocaml
Snark_ is now known as Snark
ygrek has joined #ocaml
Cyanure has joined #ocaml
avsm has joined #ocaml
ttamttam has joined #ocaml
ztfw has joined #ocaml
sebz has joined #ocaml
avsm has quit [Quit: Leaving.]
ttamttam has quit [Ping timeout: 240 seconds]
Julien_T has joined #ocaml
lopex has joined #ocaml
lpereira has joined #ocaml
edwin has joined #ocaml
larhat has joined #ocaml
ygrek has quit [Remote host closed the connection]
ikaros has joined #ocaml
ygrek has joined #ocaml
ttamttam has joined #ocaml
avsm has joined #ocaml
ttamttam has quit [Ping timeout: 244 seconds]
sebz has quit [Quit: Computer has gone to sleep.]
sebz_ has joined #ocaml
ttamttam has joined #ocaml
dirkD has joined #ocaml
sebz_ has quit [Quit: Computer has gone to sleep.]
sebz has joined #ocaml
ygrek has quit [Ping timeout: 248 seconds]
Julien_T has quit [Ping timeout: 255 seconds]
ygrek_ has joined #ocaml
<thelema> https://github.com/thelema/ocaml-pi/blob/master/pi.ml <- Computes digits of pi, uses zarith library
Julien_T has joined #ocaml
emmanuelux has joined #ocaml
<thelema> does not reach performance target of 100M digits in <10 minutes
<thelema> (this performance target is reached by python program using same algorithm)
Julien_T has quit [Ping timeout: 256 seconds]
zorun has quit [Ping timeout: 248 seconds]
zorun has joined #ocaml
ttamttam has quit [Ping timeout: 258 seconds]
funktronic has joined #ocaml
joewilliams_away is now known as joewilliams
f[x] has quit [Ping timeout: 252 seconds]
avsm1 has joined #ocaml
dirkD has quit [Ping timeout: 252 seconds]
avsm has quit [Read error: Operation timed out]
avsm1 has quit [Client Quit]
Smerdyakov has joined #ocaml
avsm has joined #ocaml
everyonemines has joined #ocaml
avsm1 has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
funktronic has left #ocaml []
everyonemines has quit [Quit: Leaving.]
lopexx has joined #ocaml
lopex has quit [Ping timeout: 248 seconds]
lopexx is now known as lopex
larhat has quit [Quit: Leaving.]
mjonsson has joined #ocaml
joewilliams is now known as joewilliams_away
sebz has quit [Quit: Computer has gone to sleep.]
imp__ has joined #ocaml
Smerdyakov has quit [Quit: Leaving]
sebz_ has joined #ocaml
ygrek_ has quit [Ping timeout: 248 seconds]
dnolen has joined #ocaml
imp__ has quit [Ping timeout: 248 seconds]
imp__ has joined #ocaml
<Skolem> Well, it is only version 1.0, but that's still a bit saddening.
ttamttam has joined #ocaml
<thelema> Skolem: it uses gmp under the hood, so it should be the same as the python
<thelema> the only difference is small int handling and auto-promotion - this might be the cause of the performance difference
<thelema> well, and the integration with the GC.
<thelema> Zarith is a great library so far, I don't want this to be its failure - maybe I'm doing something in my code that isn't so efficient
ttamttam has quit [Ping timeout: 255 seconds]
avsm1 has quit [Quit: Leaving.]
Julien_T has joined #ocaml
avsm has joined #ocaml
<flux> thelema, have you tried profiling?
<thelema> yes, 30% of the time is spent doing gmp_mul
hto has joined #ocaml
<flux> ..why not 95%?
<flux> (just assuming the algorithm is mostly multilpications ;-))
<flux> compare to the python version :)
<thelema> after that, 11.3% running my bs function, 9.2% in caml_alloc_custom, 9.2% in caml_alloc_small, 5% in ml_z_addsub
<thelema> I haven't profiled the python version
<flux> hmm, so that makes 70% in total?
<flux> maybe 20% for memory management is a bit much.
<thelema> caml_c_call is 4.6%, caml_equal is 2.5%, caml_page_table_modify another 2.5%, ...
<flux> they upped the gc parameters up by default in some ~recent ocaml version. do yuo have a version where they are upped?
<thelema> I'm using 3.12.1
struktured has quit [Read error: Connection reset by peer]
<thelema> so yes
avsm has quit [Quit: Leaving.]
<flux> well, the numbers seem reasonable
<flux> mayba compare_val and caml_equal could be shaven a bit
<flux> but GC is still the big part.
<flux> actually I wonder about ml_z_mul
<flux> it calls caml_alloc_custom a lot?
<flux> but, maybe it cannot be avoided
<flux> I guess it calls always exactly once
<flux> +it
<flux> maybe you could nevertheles try playing with the GC parameters
<flux> space_overhead sounds relevant
<thelema> well, the alternative is to try using gmp directly and see what results I get.
<thelema> but I'm busy on another project, so I'll probably leave the computation of pi for another day
avsm has joined #ocaml
avsm has quit [Quit: Leaving.]
lopexx has joined #ocaml
lopex has quit [Ping timeout: 245 seconds]
lopexx is now known as lopex
arubin has joined #ocaml
Cyanure has quit [Remote host closed the connection]
sebz_ has quit [Quit: Computer has gone to sleep.]
yezariaely has joined #ocaml
yezariaely has quit [Client Quit]
sebz has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
avsm has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
jimi_hendrix has joined #ocaml
<jimi_hendrix> hello, i asked this yesterday but got no response. I am new to OCaml, and I keep reading about how objects/classes in OCaml are used differently than in languages like C++ or Java, but articles/tutorial never elaborate as to how they are to be used. When should i use a record and when should i use an object?
<thelema> jimi_hendrix: When you need subtyping, use objects
<thelema> otherwise, records work well.
<jimi_hendrix> alright
<thelema> maybe there's some other times that objects are better than records in ocaml, but I can't think of them at the momoent.
<jimi_hendrix> also, is it common practice to make record constructor-type functions as a short hand, or to just write out the record?
<thelema> That said, this doesn't mean that one should take a java program and replace objects with records to make a good ocaml program
<thelema> It's pretty common practice, but either is fine.
<jimi_hendrix> thelema, ok
<jimi_hendrix> thelema, err making constructor functions is common practice?
<thelema> yes
<jimi_hendrix> ok
<jimi_hendrix> is there a typical naming scheme for those, like new_<record name>?
ulfdoz has quit [Ping timeout: 258 seconds]
<thelema> usually just the name of the record type
<thelema> here's some code I'm working on right now:
<thelema> type estimate = {point: float; upper: float; lower: float; confidence: float}
<thelema> let estimate p u l c = {point=p; upper=u; lower=l; confidence=c}
<jimi_hendrix> oh, ocaml can tell the difference? cool
ulfdoz has joined #ocaml
<jimi_hendrix> thelema, one more question for the time being then. with an object, is it possible to access a property without creating getter and setter functions?
<thelema> no, it's not.
<jimi_hendrix> ok
<jimi_hendrix> mildly annoying
<thelema> only if you use objects for things that shouldn't be objects
<thelema> use records and tuples for most things
<jimi_hendrix> right
ulfdoz has quit [Ping timeout: 260 seconds]
<_habnabit> normally I create my constructors as `let estimate point upper lower confidence = {point; upper; lower; confidence}`
imp__ has quit [Ping timeout: 248 seconds]
ygrek has joined #ocaml
dirkD has joined #ocaml
<thelema> _habnabit: yes, I'm still using 3.11-isms
<thelema> _habnabit: that way is better in 3.12+
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
wormphlegm has quit [Remote host closed the connection]
yezariaely has joined #ocaml
arubin has quit [Ping timeout: 240 seconds]
lpereira has quit [Read error: Connection reset by peer]
arubin has joined #ocaml
wormphlegm has joined #ocaml
<jimi_hendrix> uhh?
<jimi_hendrix> is there a difference other than appearance?
ulfdoz has joined #ocaml
<thelema> jimi_hendrix: no difference in what it compiles to, just taking advantage of new 3.12 feature that {foo} means {foo=foo}
<adrien> before it had to be { point = point; upper = upper; ... } and because of some rules for records (unique field names in a module), it might also have been { foo_point = point; upper = upper; foo_lower = lower ... }
<Qrntzz> just wondering, should widget types in a widget toolkit written in ocaml be objects?
<Qrntzz> afaik, every popular gui toolkit there is uses objects
<adrien> you're building your own?
<Qrntzz> yes, it's nothing large-scale and I don't need lablgtk or labltk
<thelema> Qrntzz: one might argue that objects were added to caml light exactly for gui toolkits.
<adrien> what's the base?
<Qrntzz> sdl
<adrien> thelema: I'd say lablgtk was created as an example/support for Garrigues' work ;-)
<Qrntzz> in fact, I'm writing a server browser for a game
<adrien> I can't help but warn you that even trivial stuff is a huge amount of work for gui toolkits
<adrien> anyway
<adrien> my answer to your original question would be: no
<Qrntzz> so as the game needs sdl to work too, they share dependencies, not to mention I'va had experience with sdl before
<Qrntzz> so would you advise using records?
<adrien> it really depends how you're doing it
<adrien> but if you get to the point you _really_ need objects because you have more than 3 or 4 cases to handle, you're probably heading to too much work
<Qrntzz> I have just about 5 widget types
yezariaely has quit [Quit: Leaving.]
<adrien> in other words: objects would be better, especially in the long run, but I hope you won't get that far
<adrien> (did I mention I was working on lablgtk myself? :-) )
<Qrntzz> what I basically need is a simple widget toolkit + the app itself before december :-)
<Qrntzz> I guess no, but that's certainly nice to hear
avsm has quit [Quit: Leaving.]
ztfw has quit [Remote host closed the connection]
struktured has joined #ocaml
edwin has quit [Remote host closed the connection]
dnolen has quit [Quit: dnolen]
Snark has quit [Quit: Quitte]
struktured has quit [Ping timeout: 276 seconds]
jamii has joined #ocaml
joewilliams_away is now known as joewilliams
hto has quit [Quit: Lost terminal]
lamawithonel has quit [Read error: Operation timed out]
dnolen has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
lamawithonel has joined #ocaml
dnolen has quit [Client Quit]
ygrek has quit [Remote host closed the connection]
Anarchos has joined #ocaml
Skolem has quit [Ping timeout: 248 seconds]
dirkD has quit [Ping timeout: 255 seconds]
joewilliams is now known as joewilliams_away
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
dirkD has joined #ocaml
dirkD has quit [Ping timeout: 260 seconds]
Amorphous has quit [Ping timeout: 244 seconds]
Amorphous has joined #ocaml
kurtosis has quit [Quit: leaving]
Julien_T has quit [Ping timeout: 276 seconds]