martintrojer has quit [Read error: Connection reset by peer]
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
martintrojer has joined #ocaml
AlexRussia has joined #ocaml
nightuser has joined #ocaml
<MercurialAlchemi>
Drup: hahahaha
<Drup>
the back story with the contest is stupidly awesome
<nightuser>
hi. i'm relatively new to ocaml (one term project written completely in ocaml) and i want to get some real experience with this lang. so, is there any oss projects in which i can contribute?
<Drup>
probably, what's your usual interest ?
ollehar has joined #ocaml
<ollehar>
letstack a = 10 in ... ?
<ollehar>
stack allocation
<nightuser>
Drup: well, my primary field is statistics, however i'm interested in something related to compilers/formal grammars/etc (and i'm reading dragon book at the moment).
<ollehar>
how much faster would a program be if you do not collect any memory?
<Drup>
It would be very fast until it's not fast at all.
<ollehar>
Drup: yes :)
<ollehar>
hm
zpe has quit [Remote host closed the connection]
<MercurialAlchemi>
Drup: where is the backstory? I read the stuff about the words of power...
<gasche>
ollehar: note the alternative OCaml version that has laxer GC setting
<magistr>
Rust is a functional language and it is not may in tail call
<gasche>
it consumes twice as much memory as the default OCaml version (which itself consumed as much as the C version), but runs exactly as fast as the Rust version
<gasche>
(and still that means twice less memory than the Java version)
<gasche>
it looks like the JVM can recognize settings that allocate like crazy and is tuned by default to blow up the memory budget to preserve throughput (not necessarily a bad choice in server environments)
<magistr>
and "Rust does not have the “C-style” for loop on purpose. Manually controlling each element of the loop is complicated and error prone, even for experienced C developers."
<gasche>
but making claim about a language's GC being sensibly faster than another on these benchmarks seems difficult
<ollehar>
gasche: ah right, I just thought it was wrong algorithm
<gasche>
(not that I think the Java GC is bad; nowadays it is pretty good)
<ggole>
Mmm. It could just be a difference between default sizes of young generations.
<MercurialAlchemi>
it's fast, but it gobbles all your RAM and doesn't give it back
<ggole>
Or it could be (partly) a real difference in quality of implementation: very hard to tell without more serious testing.
<ollehar>
gasche: what's "laxer"?
<gasche>
the alternative benchamrk sets heap increment at 10Mo
<ggole>
The idea of microbenchmarks as reliable indicators of language performance is pretty fraught in any case.
<gasche>
basically the alternative GC settings will essentially make the GC not attempt to collect anything until the end of the program, exactly like what Java seems to do
<gasche>
(of course on longer-running programs with a less unrealistic workflow that would actually behave sensibly in the long run)
<ollehar>
So OCaml can collect as fast as Rust with proper GC tuning... That's something.
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<gasche>
I don't think these numbers mean much
<ollehar>
well, is there better ways to measure performance?
<ollehar>
I think all the benchmarks combined give a pretty good hunch, still.
<ggole>
Find real programs that show large amounts of time spent in the GC, and work towards improving those.
chris2 has joined #ocaml
<ollehar>
And it's possible to group languages together in speed, like C/Java, OCaml/Haskell, PHP/Python/Perl etc
<ely-se>
lol
<ollehar>
Btw, since memory gets bigger faster than CPU:s get faster, these settings make sence?
<ollehar>
ely-se: what? :)
zpe has joined #ocaml
<ggole>
Tuning is more complicated than that: part of the performance effect has to do with caching
<ggole>
If that were the only factor, the young generation size could be increased for an obvious win, and everybody would have already done that long ago.
<ollehar>
so no.
<ggole>
Small young generations have an advantage in that allocations can be made into cached memory.
<ggole>
But a disadvantage in that they do more work in other areas.
<ollehar>
ggole: "allocations can be made into cached memory". I don't understand this.
dsheets has joined #ocaml
psy_ has quit [Ping timeout: 260 seconds]
<ggole>
Say you collect a young generation that is (considerably) smaller that the largest cache on the machine.
<ggole>
When you reset the bump pointer, it will be pointing into memory that is still in that cache.
<ggole>
Walking the young generation during GC should also cache better, since it's all still fairly recently touched.
psy_ has joined #ocaml
<ggole>
In short, there are some tradeoffs.
<ollehar>
ok
<ollehar>
pizza time, thanks for the info!
BhavyaM has joined #ocaml
chris2 has joined #ocaml
BitPuffin|osx has joined #ocaml
mrm has joined #ocaml
ely-se has quit [Quit: Leaving...]
ollehar1 has joined #ocaml
ollehar has quit [Ping timeout: 260 seconds]
BitPuffin|osx has quit [Ping timeout: 245 seconds]
<ollehar1>
test
<ollehar1>
can a gc be more optimal if pauses doesn't matter?
<ollehar1>
e.g., PHP never has to be real-time.
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
xificurC has quit [Ping timeout: 265 seconds]
<ggole>
There is something of a tradeoff between throughput and latency
<ggole>
eg, the JVMs have different GCs that are designed to favour one vs the other.
<magistr>
php is most pretty language for real-time web applications :)
tmtwd has joined #ocaml
<magistr>
such as long polling and websockets
<ollehar1>
ggole: ah ok
<ollehar1>
maybe I could just steal one of those. I only they were implemented in C...!
<ggole>
GC implementations don't tend to be particularly stealable
<magistr>
Code
<magistr>
Issues 50
<magistr>
Pull requests 16
<magistr>
Wiki
<magistr>
Pulse
<ollehar1>
ban...?
<magistr>
Graphs
<magistr>
HTTPS clone URL
<magistr>
You can clone with
<magistr>
or
<magistr>
.
<magistr>
Nuclear Reactor written in PHP
<magistr>
Code
<magistr>
Issues 50
<magistr>
Pull requests 16
<ggole>
They make too many assumptions about heap layout, etc.
<magistr>
Wiki
<magistr>
Pulse
<magistr>
Graphs
<magistr>
HTTPS clone URL
<magistr>
You can clone with
<magistr>
or
<magistr>
.
<magistr>
Nuclear Reactor written in PHP
<ollehar1>
ggole: could you please ban that dude?
<magistr>
poh
<ggole>
I don't have ops here.
<ollehar1>
ok
<magistr>
u may ban me
<magistr>
i not need on answers on my questions by topic
<Drup>
ping adrien adrien_znc ^
grouzen has quit [Ping timeout: 244 seconds]
<magistr>
to learn the any functional programming language it is necessary to know algebraic structures, systems of algebra and other applications of the discrete mathematics
<flux>
no.
<nightuser>
hmm. does ocaml have some "todo" operator like `???` in Scala or `undefined` in Haskell?
<magistr>
aximatic set theory to understanding a type thory
<magistr>
HoTT
<magistr>
topology
<magistr>
homology theory
<gasche>
magistr: there are many theories that are related to functional programming, and it is scientifically interesting
<gasche>
that does not mean you should learn them if you want to learn functional programming
<gasche>
in particular, I think blog posts about the Yoneda Lemma are silly
<gasche>
some people like the hype about Category Theory; but in practice it is essentially useless for programming (functional or not)
<gasche>
(it *can* be used to guide interesting designs (and also horribly overkill designs), but so can meditation and swimming, and people don't feel encouraged to practice those when programming)
<magistr>
functional language is not need for me, it is more interesting to learn math
<gasche>
be my guest, learn math
yomimono has quit [Quit: Leaving]
<gasche>
there is no need to spam an IRC channel with copy-pastes of github menus, though
<Enjolras>
companion_cube: i had never realized how cool containers was. Thanks :)
<magistr>
Cat theory is explain simple common things
<magistr>
and CT is simple
<magistr>
ZFC is most useful
<magistr>
to understand
<gasche>
I doubt it (useful for what?)
<magistr>
to use it in to construct types for example
<magistr>
project types in your programm is a main thing
<magistr>
and write a signatures
<Enjolras>
is it possible to specify _tags directly in oasis for convenience ? 've seen that there is a XOCamlbuildPluginTags, which is an alpha features, but it doesn't appear to work
<Enjolras>
(the goal is to avoir commiting autogenerated contents in git)
ril has joined #ocaml
<magistr>
and in Haskell Functor in category Hask is must be a Endefunctor, or I don't understand Cat theory
<magistr>
or a own contexts must be forms a subcathegory...
zpe has joined #ocaml
<Drup>
Enjolras: use the dynamic setup for dev
<Drup>
Enjolras: XOCamlbuildPluginTags is for something different (namely: compiling myocamlbuild.ml with some tags)
<Drup>
with the dynamic setup, the files are either tiny or non existent
<magistr>
and "for all" quantification it is a don't right way to organize existential types
AltGr has left #ocaml [#ocaml]
<magistr>
fp is a learn and learn math..
cdidd_ is now known as cdidd
BitPuffin|osx has joined #ocaml
ollehar has joined #ocaml
<magistr>
algebraic topology is interesting subject
contempt has quit [Ping timeout: 240 seconds]
contempt has joined #ocaml
octachron has joined #ocaml
<magistr>
topology is not use only to solve partial differential equations
<magistr>
it helps to construct theorems for example
Anarchos has joined #ocaml
tashjash has joined #ocaml
rand000 has quit [Quit: leaving]
zpe has quit [Remote host closed the connection]
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ely-se has joined #ocaml
zpe has joined #ocaml
antkong has quit [Quit: antkong]
tashjash has quit [Quit: Leaving]
grouzen has joined #ocaml
kakadu has quit [Remote host closed the connection]
octachron has quit [Quit: Leaving]
<magistr>
russian pigs
<magistr>
it has awful comunity
<magistr>
and they generate awful code
<Anarchos>
magistr could you explain ?
<magistr>
Anarchos, dirty and ugly code
<Anarchos>
magistr where ?
<magistr>
Anarchos, in they projects
<magistr>
Anarchos, and they hate each other
<Anarchos>
magistr i am curious to read their code, to build my own opinion
<magistr>
Anarchos, and they not a Humans
<magistr>
Anarchos, it is a russian pigs
kakadu has joined #ocaml
ely-se has quit [Quit: Leaving...]
dinasor has quit [Quit: RAWR IM A DINASOR!!1 (brb)]
kakadu has quit [Remote host closed the connection]
<mrm>
magistr: Are you talking about the community of algebraic topologists? :-P
<magistr>
mrm, no only or a russain programmers
kakadu has joined #ocaml
<mrm>
By the way, there are a handful of russian guys here, so be gentle ;-)
kakadu has quit [Client Quit]
<magistr>
mrm, they must go on dick
<mrm>
:-(
<mrm>
magistr: I have a strong feeling that you are a russian yourself.
<magistr>
it is implication
<mrm>
A kind of russian that makes me feel ashamed of my nation.
<mrm>
Are you drunk?
ely-se has joined #ocaml
<magistr>
are u stupid?
<ely-se>
No, I'm pretty smart.
<magistr>
not u
<ely-se>
Somebody who says "u" and asks people whether they are stupid is mildly amusing.
<Drup>
Please don't feed the trolls. :)
<iZsh>
someone should run the GC on this channel
kakadu has joined #ocaml
kakadu has quit [Remote host closed the connection]
<magistr>
iZsh, ask them
nightuser has quit [Ping timeout: 240 seconds]
<magistr>
iZsh, also, u know how works gc in ocaml?
<magistr>
iZsh, mark and sweep?
<magistr>
ocaml has not TCO with tail rec, when i tried it
<magistr>
and it is a interesting compiler
<flux>
magistr, ocaml most certainly has TCO, works in all call cases not just recursion
vanila has joined #ocaml
<vanila>
hi
<magistr>
flux, i tried it three years ago
<flux>
well, it had it then
<flux>
nowadays you can also get editor feedback indicating whether your call is in tail position or not
<magistr>
and any functional language has TCO
<flux>
well, not true. Common Lisp doesn't have it.
<vanila>
I always found that strange, what is the benifit of not having it?
<magistr>
i don't know Common Lisp...
<flux>
well, in Java it is/was probably some security related, Python's excuse is that it messes up with the stack traces
<magistr>
i try to find normal documentation on it
<magistr>
I read HyperSpec :)
<ggole>
Many CL compilers provide it anyway.
<magistr>
must be
<flux>
I suppose using the optimization is OK if you know your implementation will always support it
<flux>
but it is a feature the language must have in order for you to rely on it
<flux>
of course, it's nice that it brings lower overhead, but TCO is something that can transfer a program that east all memory and crashes into a program that works
<ggole>
There are some optimisations that TCO disallows, though
ollehar has quit [Ping timeout: 245 seconds]
QuanticPotato has quit [Ping timeout: 256 seconds]
<magistr>
flux, why u use CL?
AlexRussia has quit [Read error: Connection reset by peer]
<ely-se>
Does OCaml have downcasts?
<flux>
I don't use CL
<flux>
ely-se, no
<ely-se>
cool
<vanila>
ggole, really what ones?
<magistr>
php is more difficult in use than your fp
darkf has quit [Ping timeout: 244 seconds]
<ggole>
Stack allocation of anything passed to the tail-callee
bobry has joined #ocaml
ygrek has joined #ocaml
badkins has joined #ocaml
hefner has joined #ocaml
<ely-se>
I'm not sure how to unit test my code generator.
<vanila>
does it generate assembly code?
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<ely-se>
No, it generates bytecode for a custom instruction set.
nightuser has joined #ocaml
<vanila>
do you have an interpreter for it? maybe that could be useful for the unit testing
<ely-se>
Yup, a VM.
<vanila>
so you could try something like have an intpreter i1 for the input language & i2 for t he vm language
<ely-se>
I could make the test generate random programs of which it knows the output, then invoke the VM with those programs and observe the output.
<vanila>
then i1 e == compile (i2 e) is a good test
<dmbaturin>
ely-se: I'm not sure if unit testing in its original sense is applicable to code generators.
yomimono has joined #ocaml
<vanila>
you can random tests but I would make a long list of "interesting" tests
<vanila>
e.g. things that you know triggered bugs in the code-gen in the past
<ely-se>
But the VM is also work-in-progress so it might not be correct.
<vanila>
that way you can be sure you don't reintroduce the bug
<dmbaturin>
ely-se: However, you can probably run predefined programs through it and then export the state of the abstract machine and compare e.g. register contents.
<vanila>
that's ok that it might not be correct: there are only tests - not proofs
<dmbaturin>
(If it's a register machine, of course, if not, then something else that is representative :)
Anarchos has joined #ocaml
<ely-se>
It's a stack machine, but there's a breakpoint instruction (which is also used in the VM tests).
<ggole>
Generating test programs is a bit tricky, though
ygrek has quit [Ping timeout: 256 seconds]
<ely-se>
The VM tests resume threads until breakpoints are hit, then observe the call stacks and evaluation stacks.
<ely-se>
I could write a little tool to export the state to JSON file.
QuanticPotato has joined #ocaml
<vanila>
anything you can check for equality
<ely-se>
Although that's still fragile.
<flux>
ely-se, write valid but tricky programs that return 1 on success?
<ely-se>
The VM may do various modifications to the code itself, and it also has internal instructions that aren't part of the public instruction set.
<flux>
or some other predetermined value
<ely-se>
flux: yeah, that's probably better.
yomimono has quit [Ping timeout: 240 seconds]
slash^ has joined #ocaml
<ggole>
Equality is very tricky
<ggole>
As soon as you introduce optimisations you run into serious trouble trying to say when two machine states are equivalent
<ely-se>
I think I will write lots of sample programs that test various aspects of the language along with their expected outcomes.
<ely-se>
Then run the entire toolchain on those programs.
<ely-se>
Like end-to-end tests.
nightuser has quit [Read error: Connection reset by peer]
yomimono has joined #ocaml
<ggole>
Another reasonable way to find bugs is to assert the hell out of everything and run a lot of (possible randomly generated) input through it
<ggole>
You don't have to worry about equality doing that.
<flux>
I think it might be quite difficult to write correct assertions for optimizations?
<dmbaturin>
However, since register and memory layout may also change without effect on the execution... Maybe making the programs store the final result at specific address and comparing only reasonable option.
<flux>
though there are probably places to use asserts as well
<ggole>
There are usually some invariants you can look for.
<flux>
basically optimization destroys a fragment of code and then creates new one to do the same thing but faster.. how do you assert that?
<ely-se>
You run it and check whether the output is the same.
nightuser has joined #ocaml
<ely-se>
It's impossible to compare arbitrary programs for equality since that would require solving the halting problem.
<flux>
yes, but that happens in the test driver, not within the optimizer
<ely-se>
(the language is Turing-complete)
<Drup>
ely-se: do like in the compiler
<Drup>
write a small program, it's output, execute program and diff with the expected output
<ely-se>
Yeah, I had that in mind.
<vanila>
you don't need to compare programs just the values they produce when run
<ely-se>
Which now I think of it is exactly what I did with my other compiler. XD
<ggole>
If you are generating the programs, you don't necessarily know the correct output
<ggole>
Although that isn't a problem for differential testing.
<vanila>
are these open source btw?
<dmbaturin>
What if some optimization creates a situation when some state becomes incorrect after the test program output a value?
<vanila>
i want to learn abuot compilers
<magistr>
vanila, dragon book
<dmbaturin>
I.e. it's correct for that example, but in a larger program it wouldn't be correct.
<ely-se>
The dragon book is the most boring book I've read.
<ggole>
Also, "running a program" doesn't tell you whether a translation is correct
<magistr>
it is good book on compilers
<ggole>
Only whether it is correct for that given input
<dmbaturin>
If you want someone to never start writing compilers, give them the dragon book. ;)
<ggole>
And it's really easy to miss the edge cases
<ggole>
I don't think there's any easy answer to the problem.
<vanila>
"test cannot prove the absence of bugs"
<dmbaturin>
It's probably better to avoid optimizations whose correctness you can't prove.
<ely-se>
Some tests can.
<vanila>
yeah thats true ^^
<ely-se>
But they're equivalent to proof by exhaustion.
<vanila>
but in general its not to prove
<vanila>
so situations like " state becomes incorrect after the test program output"
<dmbaturin>
Besides, verified optimizations should make good conference papers. ;)
<vanila>
it's a shame, it can happen
<vanila>
but it's okay
<ely-se>
A lot of information is luckily available at runtime, so I can test lots of properties.
<Drup>
the issue with the dragon book is that it's not really that valid anymore
systmkor has quit [Quit: Leaving]
<ely-se>
Types are fully reified which is needed because otherwise downcasts must be either unsafe or limited.
<Drup>
it doesn't say much about modern optimisation technique and how you would design a compiler nowadays
<ggole>
A first compiler should probably be pretty simple anyway.
<ggole>
Otherwise you'll drown no matter the text.
<vanila>
I've been studying register allocation for a few weeks
<vanila>
but I couldn't find any really satisfying algorithms, it's very disheartening
<vanila>
maybe im too much of a perfectionist
<ely-se>
Your first compiler should probably be one for a dynamically typed language.
<ggole>
Allocation is an annoying problem (if you are anal about code quality).
<ely-se>
It's much easier to implement.
<ggole>
All of the textbook algorithms are way oversimplified (without being particularly easy to implement).
<Drup>
ely-se: is it ?
<Drup>
I don't really find so
<vanila>
I'm really anal yeah, I accept that we need heuristics (because a lot of problems are NP hard) but even then there are still warts in every method ive learned about
<ely-se>
Yes; you don't have to implement a type checking algorithm.
<Drup>
simple type checking is very simple
<ggole>
I think ssa tree scan is probably the most promising
<ggole>
Although I haven't done an implementation yet
<Drup>
(it gros complicated quite quickly, I agree)
<ggole>
(Since the whole language is available at compile time.)
<ely-se>
-1 not in the type system
<Drup>
ggole: I can spin that in Idris or Agda too, but that's lightly unfair. :]
<Drup>
slightly*
slash^ has quit [Read error: Connection reset by peer]
<ely-se>
In D it's also easy.
<ely-se>
You can call arbitrary functions at compile-time, and they can then return strings of D source code which you can then mix in at the call-site.
<Drup>
ely-se: but in Idris and Agda, it *is* in the type system :D