Re: "ocaml_beginners"::[] speed of 32 bit versus 64 installations
| Newsgroups | gmane.comp.lang.ocaml.beginners |
|---|---|
| Message-ID | <[email protected]> |
Your code seems to do 64-bit integer calculations. The register-size is 64 bit on x64 but 32 bit on x86. This means that arithmetic operations on 64 bit integers can be done in a single step (more or less) on x64. On x86 the code must handle things like carry over in software, thus requiring multiple steps for 64-bit arithmetic. In general x64 code is faster than x86, but can also be slower e.g. due to the increased pointer size. I don't know about the state of available (x64) ocaml packages for Ubuntu or Windows. regards Markus On 2015-01-25 23:28, [email protected] [ocaml_beginners] wrote: > Consider the following program: > http://codeforces.com/contest/498/submission/9305810 > > I'm running it on this input: > 100000 100000 100000 100000 100000 100000 100000 > > I'm testing it on three machines: > > A: 2008 macbook pro > 2.4GHz Intel Core 2 Duo > running ocaml 4.01.0, in 64-bits > > B: An ubuntu Desktop. /proc/cpuinfo gives: > vendor_id : GenuineIntel > cpu family : 6 > model : 23 > model name : Intel(R) Core(TM)2 Quad CPU Q9550 @ 2.83GHz > running ocaml 4.01.0, in 32-bits > > C: A very new high-powered machine running wndows server. > (I don't have the exact details. This is the machine running on > the codeforces server.) > running ocaml 4.00.1, in 32-bits > > Here are the results: > > A: 1.08 seconds > B: 2.95 seconds > C: over 3 seconds > > I believe that machines B and C are newer and at least as fast as > machine A. Yet machine A solves this problem three times faster. > The > conclusion is that the 64 bit installation of ocaml is MUCH faster > (at > least three times as fast) as the 32 bit installation. (On this > program anyway.) > > Which leads to the question: Is there a precompiled package to > install > the 64 bit version on Ubuntu? On Windows? It seems kind of > important. > > Another question. The ocaml version on try.ocamlpro.com has 32-bit > integers. max_int is 2147483647. I've never seen a release of ocaml > with 32 bit integers. Normally it is 31 bits or 63 bits. What > gives? > Thanks. > > Danny Sleator -- Markus Weißmann, M.Sc. Technische Universität München Institut für Informatik Boltzmannstr. 3 D-85748 Garching Germany http://wwwknoll.in.tum.de/