digitalmars.D - Julia vs. D?
- Chris (5/5) May 06 2014 I recently came across this article
- Paulo Pinto (14/20) May 06 2014 I can only comment on design features.
- bearophile (5/8) May 06 2014 Unlike dynamic languages, at running time all variables are
- Ary Borenszweig (2/7) May 06 2014 What do you mean?
- Chris (4/16) May 06 2014 Just a wild guess: that the compiler infers the type of a
- bearophile (4/6) May 06 2014 Yes, and also gives almost native performance.
- Dejan Lekic (4/13) May 06 2014 One can argue that every modern JIT achieves "almost native performance"...
- bearophile (4/6) May 06 2014 OK. Then for Julia remove the "almost" :-)
- Ary Borenszweig (5/20) May 06 2014 Julia doesn't have a compiler. There's no compile-time and run-time
- Chris (12/39) May 06 2014 I know. I was talking about JIT compilation. There must be some
- Paulo Pinto (15/50) May 06 2014 They can be re-assigned (http://forio.com/julia/repl/):
- Chris (5/74) May 06 2014 So what's the point then? To have the program crash at runtime or
- bearophile (7/14) May 06 2014 I think the JIT compiler splits those two in two different
- Paulo Pinto (5/19) May 06 2014 That is an implementation detail I would say, but then again I only saw
- bearophile (10/11) May 06 2014 It's not an implementation detail, it has consequences on the
- Paulo Pinto (11/23) May 06 2014 Maybe we are talking across each other, but JIT code is always
- Chris (8/20) May 07 2014 So this basically means:
- Mason McGill (9/12) May 07 2014 Hmm... Then how can I do this:
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (11/23) May 07 2014 Maybe the first x stops existing, and a new one is created on
- Ary Borenszweig (11/35) May 07 2014 I just tried it. I also used the code_llvm function to see what llvm is
- Chris (6/27) May 06 2014 Maybe it's time to think about a D interface to Julia. If Julia
- Mason McGill (13/19) May 06 2014 I've actually been working on just that, on and off for a few
- Chris (5/24) May 07 2014 I was also thinking in the direction of enabling D to use
- John Colvin (4/33) May 07 2014 That would be very good. If julia is to become a/the norm for
- bachmeier (4/33) May 07 2014 It's really easy to do that with R. There is a package RInside
- Chris (3/37) May 07 2014 Would be cool if we had something like this for Julia (if it
- Laeeth Isharc (13/51) Dec 11 2014 I guess you can call D from Julia very easily via the C API and
- Brian Rogoff (14/33) May 06 2014 Excellent summary, one quibble, you omit MATLAB and Octave users
I recently came across this article http://www.wired.com/2014/02/julia/. On the Julia homepage there are some benchmarks times relative to C. I know that bearophile has mentioned Julia several times on this forum. Has anyone compared D's vs Julia's performance as well as design features?
May 06 2014
On Tuesday, 6 May 2014 at 09:11:30 UTC, Chris wrote:I recently came across this article http://www.wired.com/2014/02/julia/. On the Julia homepage there are some benchmarks times relative to C. I know that bearophile has mentioned Julia several times on this forum. Has anyone compared D's vs Julia's performance as well as design features?I can only comment on design features. You can think of Julia as a dynamic language similar to Python, with optional typing and for such a young language, a quite good JIT compiler backed by the LLVM backend. It is a multi-paradigm language, with an OO approach based on multi-methods and direct support for scientific programming. The target audience are the scientifc community that makes use of R, Python with NumPy and so on, which are currently disappointed with the performance of said systems. Their goal is to keep the programming flexibility of R and Python, while improving the performance without having to be forced to write C code. -- Paulo
May 06 2014
Paulo Pinto:You can think of Julia as a dynamic language similar to Python, with optional typing and for such a young language, a quite good JIT compiler backed by the LLVM backend.Unlike dynamic languages, at running time all variables are strongly typed. Bye, bearophile
May 06 2014
On 5/6/14, 8:23 AM, bearophile wrote:Paulo Pinto:What do you mean?You can think of Julia as a dynamic language similar to Python, with optional typing and for such a young language, a quite good JIT compiler backed by the LLVM backend.Unlike dynamic languages, at running time all variables are strongly typed.
May 06 2014
On Tuesday, 6 May 2014 at 13:25:56 UTC, Ary Borenszweig wrote:On 5/6/14, 8:23 AM, bearophile wrote:Just a wild guess: that the compiler infers the type of a variable and turns it into a static type. That would increase the security during runtime (plugins, libraries, crackers).Paulo Pinto:What do you mean?You can think of Julia as a dynamic language similar to Python, with optional typing and for such a young language, a quite good JIT compiler backed by the LLVM backend.Unlike dynamic languages, at running time all variables are strongly typed.
May 06 2014
Chris:That would increase the security during runtime (plugins, libraries, crackers).Yes, and also gives almost native performance. Bye, bearophile
May 06 2014
bearophile wrote:Chris:One can argue that every modern JIT achieves "almost native performance" ... -- http://dejan.lekic.orgThat would increase the security during runtime (plugins, libraries, crackers).Yes, and also gives almost native performance. Bye, bearophile
May 06 2014
Dejan Lekic:One can argue that every modern JIT achieves "almost native performance" ...OK. Then for Julia remove the "almost" :-) Bye, bearophile
May 06 2014
On 5/6/14, 10:41 AM, Chris wrote:On Tuesday, 6 May 2014 at 13:25:56 UTC, Ary Borenszweig wrote:Julia doesn't have a compiler. There's no compile-time and run-time distinction. But functions are jitted before execution. I don't see how that means "variables are strongly typed". If you mean that at runtime they carry their type information, so do dynamic languages.On 5/6/14, 8:23 AM, bearophile wrote:Just a wild guess: that the compiler infers the type of a variable and turns it into a static type. That would increase the security during runtime (plugins, libraries, crackers).Paulo Pinto:What do you mean?You can think of Julia as a dynamic language similar to Python, with optional typing and for such a young language, a quite good JIT compiler backed by the LLVM backend.Unlike dynamic languages, at running time all variables are strongly typed.
May 06 2014
On Tuesday, 6 May 2014 at 17:10:39 UTC, Ary Borenszweig wrote:On 5/6/14, 10:41 AM, Chris wrote:I know. I was talking about JIT compilation. There must be some kind of (jit) compiler.On Tuesday, 6 May 2014 at 13:25:56 UTC, Ary Borenszweig wrote:Julia doesn't have a compiler. There's no compile-time and run-time distinction. But functions are jitted before execution.On 5/6/14, 8:23 AM, bearophile wrote:Just a wild guess: that the compiler infers the type of a variable and turns it into a static type. That would increase the security during runtime (plugins, libraries, crackers).Paulo Pinto:What do you mean?You can think of Julia as a dynamic language similar to Python, with optional typing and for such a young language, a quite good JIT compiler backed by the LLVM backend.Unlike dynamic languages, at running time all variables are strongly typed.I don't see how that means "variables are strongly typed". If you mean that at runtime they carry their type information, so do dynamic languages.But are the types immutable at runtime (in other dynamically typed languages) or can they be reassigned as in x = "Hello" x = 5 If yes, then I think this is what Julia is addressing, that a module, library or malevolent cracker cannot reassign a different type to a variable. x = 5 // Error! If so,
May 06 2014
Am 06.05.2014 22:44, schrieb Chris:On Tuesday, 6 May 2014 at 17:10:39 UTC, Ary Borenszweig wrote:They can be re-assigned (http://forio.com/julia/repl/): julia> x = "Hello" "Hello" julia> x = 5 5 julia> Julia compiler works in a similar way to Self, Strongtalk, Dylan, Lisp and so on. The language is dynamic, with optional type annotations and the compiler does its best to infer the types. The design of the language is done in a JIT friendly way, while keeping its dynamic capabilities. -- PauloOn 5/6/14, 10:41 AM, Chris wrote:I know. I was talking about JIT compilation. There must be some kind of (jit) compiler.On Tuesday, 6 May 2014 at 13:25:56 UTC, Ary Borenszweig wrote:Julia doesn't have a compiler. There's no compile-time and run-time distinction. But functions are jitted before execution.On 5/6/14, 8:23 AM, bearophile wrote:Just a wild guess: that the compiler infers the type of a variable and turns it into a static type. That would increase the security during runtime (plugins, libraries, crackers).Paulo Pinto:What do you mean?You can think of Julia as a dynamic language similar to Python, with optional typing and for such a young language, a quite good JIT compiler backed by the LLVM backend.Unlike dynamic languages, at running time all variables are strongly typed.I don't see how that means "variables are strongly typed". If you mean that at runtime they carry their type information, so do dynamic languages.But are the types immutable at runtime (in other dynamically typed languages) or can they be reassigned as in x = "Hello" x = 5 If yes, then I think this is what Julia is addressing, that a module, library or malevolent cracker cannot reassign a different type to a variable. x = 5 // Error! If so,
May 06 2014
On Tuesday, 6 May 2014 at 20:52:20 UTC, Paulo Pinto wrote:Am 06.05.2014 22:44, schrieb Chris:So what's the point then? To have the program crash at runtime or better jit-time when the types are not assigned correctly? Then again, if types can be changed dynamically, how can the jit compiler say it's "wrong"? Or is there something I've missed?On Tuesday, 6 May 2014 at 17:10:39 UTC, Ary Borenszweig wrote:They can be re-assigned (http://forio.com/julia/repl/): julia> x = "Hello" "Hello" julia> x = 5 5 julia> Julia compiler works in a similar way to Self, Strongtalk, Dylan, Lisp and so on. The language is dynamic, with optional type annotations and the compiler does its best to infer the types. The design of the language is done in a JIT friendly way, while keeping its dynamic capabilities. -- PauloOn 5/6/14, 10:41 AM, Chris wrote:I know. I was talking about JIT compilation. There must be some kind of (jit) compiler.On Tuesday, 6 May 2014 at 13:25:56 UTC, Ary Borenszweig wrote:Julia doesn't have a compiler. There's no compile-time and run-time distinction. But functions are jitted before execution.On 5/6/14, 8:23 AM, bearophile wrote:Just a wild guess: that the compiler infers the type of a variable and turns it into a static type. That would increase the security during runtime (plugins, libraries, crackers).Paulo Pinto:What do you mean?You can think of Julia as a dynamic language similar to Python, with optional typing and for such a young language, a quite good JIT compiler backed by the LLVM backend.Unlike dynamic languages, at running time all variables are strongly typed.I don't see how that means "variables are strongly typed". If you mean that at runtime they carry their type information, so do dynamic languages.But are the types immutable at runtime (in other dynamically typed languages) or can they be reassigned as in x = "Hello" x = 5 If yes, then I think this is what Julia is addressing, that a module, library or malevolent cracker cannot reassign a different type to a variable. x = 5 // Error! If so,
May 06 2014
Paulo Pinto:They can be re-assigned (http://forio.com/julia/repl/): julia> x = "Hello" "Hello" julia> x = 5 5 julia>I think the JIT compiler splits those two in two different variables :-)The language is dynamic,The language tries its best to be flexible as a dynamic language. But variables never carry a run-time type tag, unlike in Lisp. Bye, bearophile
May 06 2014
Am 06.05.2014 23:00, schrieb bearophile:Paulo Pinto:That is an implementation detail I would say, but then again I only saw a few talks online and have not played that much with it. -- PauloThey can be re-assigned (http://forio.com/julia/repl/): julia> x = "Hello" "Hello" julia> x = 5 5 julia>I think the JIT compiler splits those two in two different variables :-)The language is dynamic,The language tries its best to be flexible as a dynamic language. But variables never carry a run-time type tag, unlike in Lisp. Bye, bearophile
May 06 2014
Paulo Pinto:That is an implementation detail I would say,It's not an implementation detail, it has consequences on the kind of code you are allowed to write, because it's not really a dynamic language. After the JIT compilation it's "statically" typed, with some niceties like the type splitting you have seen with the x variable. In Julia you can't write all the programs you can write in Python. But in practice the limitations are not a problem for the scientific code, and the advantages are great. Bye, bearophile
May 06 2014
On Tuesday, 6 May 2014 at 21:31:32 UTC, bearophile wrote:Paulo Pinto:Maybe we are talking across each other, but JIT code is always statically typed after native code generation. The approach taken by Julia is no different than other dynamic languages that enjoy AOT native compilers. If you mean Julia allows for less dynamic programming cleverness as Python, there I agree with you. I guess I need to play more with it, maybe then I can better grasp what you mean. -- PauloThat is an implementation detail I would say,It's not an implementation detail, it has consequences on the kind of code you are allowed to write, because it's not really a dynamic language. After the JIT compilation it's "statically" typed, with some niceties like the type splitting you have seen with the x variable. In Julia you can't write all the programs you can write in Python. But in practice the limitations are not a problem for the scientific code, and the advantages are great. Bye, bearophile
May 06 2014
On Tuesday, 6 May 2014 at 21:31:32 UTC, bearophile wrote:Paulo Pinto:So this basically means: setName(name) userName = name; // string type extern module / cracker: setName(5.0) // Error or at least doesn't affect original userName Right or wrong?That is an implementation detail I would say,It's not an implementation detail, it has consequences on the kind of code you are allowed to write, because it's not really a dynamic language. After the JIT compilation it's "statically" typed, with some niceties like the type splitting you have seen with the x variable. In Julia you can't write all the programs you can write in Python. But in practice the limitations are not a problem for the scientific code, and the advantages are great. Bye, bearophile
May 07 2014
On Tuesday, 6 May 2014 at 21:00:18 UTC, bearophile wrote:The language tries its best to be flexible as a dynamic language. But variables never carry a run-time type tag, unlike in Lisp.Hmm... Then how can I do this: x = 5 x = 5.0 ? Is Julia doing something trickier than I think it is? Or do you just mean they don't carry type tags after compilation?
May 07 2014
On Wednesday, 7 May 2014 at 07:27:42 UTC, Mason McGill wrote:On Tuesday, 6 May 2014 at 21:00:18 UTC, bearophile wrote:Maybe the first x stops existing, and a new one is created on reassignment? A more interesting case is this (pseudo code, don't know Julia syntax): x = 5 if (...) { x = "Hello" } Is that disallowed?The language tries its best to be flexible as a dynamic language. But variables never carry a run-time type tag, unlike in Lisp.Hmm... Then how can I do this: x = 5 x = 5.0 ? Is Julia doing something trickier than I think it is? Or do you just mean they don't carry type tags after compilation?
May 07 2014
On 5/7/14, 6:18 AM, "Marc Schütz" <schuetzm gmx.net>" wrote:On Wednesday, 7 May 2014 at 07:27:42 UTC, Mason McGill wrote:I just tried it. I also used the code_llvm function to see what llvm is generated. Some lines: %8 = call %jl_value_t* jl_box_int32(i32 %0), !dbg !4339 (an int is being boxed and you get a pointer to a jl_value_t) %13 = call %jl_value_t* jl_apply_generic(%jl_value_t* inttoptr (i64 4373507136 to %jl_value_t*), %jl_value_t** %6, i32 2), !dbg !4346 (a generic function call is being made) So, there clearly must be runtime information associated to the variables, at least when they need boxing or this kind of multi-dispatch at runtime.On Tuesday, 6 May 2014 at 21:00:18 UTC, bearophile wrote:Maybe the first x stops existing, and a new one is created on reassignment? A more interesting case is this (pseudo code, don't know Julia syntax): x = 5 if (...) { x = "Hello" } Is that disallowed?The language tries its best to be flexible as a dynamic language. But variables never carry a run-time type tag, unlike in Lisp.Hmm... Then how can I do this: x = 5 x = 5.0 ? Is Julia doing something trickier than I think it is? Or do you just mean they don't carry type tags after compilation?
May 07 2014
On Tuesday, 6 May 2014 at 11:20:33 UTC, Paulo Pinto wrote:On Tuesday, 6 May 2014 at 09:11:30 UTC, Chris wrote:Maybe it's time to think about a D interface to Julia. If Julia catches on within the scientific community, it would be good to have a foot in the door. Science quickly creates large code bases, unfortunately, so far it's mostly Python and Matlab which makes it hard to use the algorithms in real world applications.I recently came across this article http://www.wired.com/2014/02/julia/. On the Julia homepage there are some benchmarks times relative to C. I know that bearophile has mentioned Julia several times on this forum. Has anyone compared D's vs Julia's performance as well as design features?I can only comment on design features. You can think of Julia as a dynamic language similar to Python, with optional typing and for such a young language, a quite good JIT compiler backed by the LLVM backend. It is a multi-paradigm language, with an OO approach based on multi-methods and direct support for scientific programming. The target audience are the scientifc community that makes use of R, Python with NumPy and so on, which are currently disappointed with the performance of said systems. Their goal is to keep the programming flexibility of R and Python, while improving the performance without having to be forced to write C code. -- Paulo
May 06 2014
On Tuesday, 6 May 2014 at 11:28:21 UTC, Chris wrote:Maybe it's time to think about a D interface to Julia. If Julia catches on within the scientific community, it would be good to have a foot in the door. Science quickly creates large code bases, unfortunately, so far it's mostly Python and Matlab which makes it hard to use the algorithms in real world applications.I've actually been working on just that, on and off for a few months now. Such a thing is kind of "anti-Julian", though, since one of Julia's main goals is to reduce or eliminate the need for mixed-language projects. However, with D, you can compile small shared libraries that can be automatically bound to your users' favorite dynamic runtimes (via compile-time reflection). I'm hoping this will be good for both D and Julia, allowing library developers to reach a broader audience, and library consumers greater flexibility. I'll post on the D "announce" thread when I have something working, and I'd definitely appreciate tests/bug-reports at that time!
May 06 2014
On Tuesday, 6 May 2014 at 23:19:47 UTC, Mason McGill wrote:On Tuesday, 6 May 2014 at 11:28:21 UTC, Chris wrote:I was also thinking in the direction of enabling D to use existing Julia code seamlessly, so you can just call it from D (extern(J)), and maybe even efficiently compile it into binaries along with D code, as you would with extern(C) calls now.Maybe it's time to think about a D interface to Julia. If Julia catches on within the scientific community, it would be good to have a foot in the door. Science quickly creates large code bases, unfortunately, so far it's mostly Python and Matlab which makes it hard to use the algorithms in real world applications.I've actually been working on just that, on and off for a few months now. Such a thing is kind of "anti-Julian", though, since one of Julia's main goals is to reduce or eliminate the need for mixed-language projects. However, with D, you can compile small shared libraries that can be automatically bound to your users' favorite dynamic runtimes (via compile-time reflection). I'm hoping this will be good for both D and Julia, allowing library developers to reach a broader audience, and library consumers greater flexibility. I'll post on the D "announce" thread when I have something working, and I'd definitely appreciate tests/bug-reports at that time!
May 07 2014
On Wednesday, 7 May 2014 at 09:16:01 UTC, Chris wrote:On Tuesday, 6 May 2014 at 23:19:47 UTC, Mason McGill wrote:That would be very good. If julia is to become a/the norm for scientific computing, D could form the full-power systems/applications partner very neatly.On Tuesday, 6 May 2014 at 11:28:21 UTC, Chris wrote:I was also thinking in the direction of enabling D to use existing Julia code seamlessly, so you can just call it from D (extern(J)), and maybe even efficiently compile it into binaries along with D code, as you would with extern(C) calls now.Maybe it's time to think about a D interface to Julia. If Julia catches on within the scientific community, it would be good to have a foot in the door. Science quickly creates large code bases, unfortunately, so far it's mostly Python and Matlab which makes it hard to use the algorithms in real world applications.I've actually been working on just that, on and off for a few months now. Such a thing is kind of "anti-Julian", though, since one of Julia's main goals is to reduce or eliminate the need for mixed-language projects. However, with D, you can compile small shared libraries that can be automatically bound to your users' favorite dynamic runtimes (via compile-time reflection). I'm hoping this will be good for both D and Julia, allowing library developers to reach a broader audience, and library consumers greater flexibility. I'll post on the D "announce" thread when I have something working, and I'd definitely appreciate tests/bug-reports at that time!
May 07 2014
On Wednesday, 7 May 2014 at 09:16:01 UTC, Chris wrote:On Tuesday, 6 May 2014 at 23:19:47 UTC, Mason McGill wrote:It's really easy to do that with R. There is a package RInside that makes it trivial to embed R in a C++ program, and it's not difficult to use with D.On Tuesday, 6 May 2014 at 11:28:21 UTC, Chris wrote:I was also thinking in the direction of enabling D to use existing Julia code seamlessly, so you can just call it from D (extern(J)), and maybe even efficiently compile it into binaries along with D code, as you would with extern(C) calls now.Maybe it's time to think about a D interface to Julia. If Julia catches on within the scientific community, it would be good to have a foot in the door. Science quickly creates large code bases, unfortunately, so far it's mostly Python and Matlab which makes it hard to use the algorithms in real world applications.I've actually been working on just that, on and off for a few months now. Such a thing is kind of "anti-Julian", though, since one of Julia's main goals is to reduce or eliminate the need for mixed-language projects. However, with D, you can compile small shared libraries that can be automatically bound to your users' favorite dynamic runtimes (via compile-time reflection). I'm hoping this will be good for both D and Julia, allowing library developers to reach a broader audience, and library consumers greater flexibility. I'll post on the D "announce" thread when I have something working, and I'd definitely appreciate tests/bug-reports at that time!
May 07 2014
On Wednesday, 7 May 2014 at 12:05:10 UTC, bachmeier wrote:On Wednesday, 7 May 2014 at 09:16:01 UTC, Chris wrote:Would be cool if we had something like this for Julia (if it really catches on).On Tuesday, 6 May 2014 at 23:19:47 UTC, Mason McGill wrote:It's really easy to do that with R. There is a package RInside that makes it trivial to embed R in a C++ program, and it's not difficult to use with D.On Tuesday, 6 May 2014 at 11:28:21 UTC, Chris wrote:I was also thinking in the direction of enabling D to use existing Julia code seamlessly, so you can just call it from D (extern(J)), and maybe even efficiently compile it into binaries along with D code, as you would with extern(C) calls now.Maybe it's time to think about a D interface to Julia. If Julia catches on within the scientific community, it would be good to have a foot in the door. Science quickly creates large code bases, unfortunately, so far it's mostly Python and Matlab which makes it hard to use the algorithms in real world applications.I've actually been working on just that, on and off for a few months now. Such a thing is kind of "anti-Julian", though, since one of Julia's main goals is to reduce or eliminate the need for mixed-language projects. However, with D, you can compile small shared libraries that can be automatically bound to your users' favorite dynamic runtimes (via compile-time reflection). I'm hoping this will be good for both D and Julia, allowing library developers to reach a broader audience, and library consumers greater flexibility. I'll post on the D "announce" thread when I have something working, and I'd definitely appreciate tests/bug-reports at that time!
May 07 2014
On Wednesday, 7 May 2014 at 14:57:36 UTC, Chris wrote:On Wednesday, 7 May 2014 at 12:05:10 UTC, bachmeier wrote:I guess you can call D from Julia very easily via the C API and would just need to declare C calling convention in your D code. It may be that with a combination of Julia and D one has the best of both worlds - no compromise with speed and efficient resource use on the number crunching with a nice shell / Ipython notebook that is still pretty fast on the front end. Nicer would be a wrapper a la PyD that seamlessly translates between types. Then the other thing is to translate julia.h into D so that you can embed Julia. That's a little work but not so hard. More about how this works with C here: http://docs.julialang.org/en/release-0.3/manual/embedding/On Wednesday, 7 May 2014 at 09:16:01 UTC, Chris wrote:Would be cool if we had something like this for Julia (if it really catches on).On Tuesday, 6 May 2014 at 23:19:47 UTC, Mason McGill wrote:It's really easy to do that with R. There is a package RInside that makes it trivial to embed R in a C++ program, and it's not difficult to use with D.On Tuesday, 6 May 2014 at 11:28:21 UTC, Chris wrote:I was also thinking in the direction of enabling D to use existing Julia code seamlessly, so you can just call it from D (extern(J)), and maybe even efficiently compile it into binaries along with D code, as you would with extern(C) calls now.Maybe it's time to think about a D interface to Julia. If Julia catches on within the scientific community, it would be good to have a foot in the door. Science quickly creates large code bases, unfortunately, so far it's mostly Python and Matlab which makes it hard to use the algorithms in real world applications.I've actually been working on just that, on and off for a few months now. Such a thing is kind of "anti-Julian", though, since one of Julia's main goals is to reduce or eliminate the need for mixed-language projects. However, with D, you can compile small shared libraries that can be automatically bound to your users' favorite dynamic runtimes (via compile-time reflection). I'm hoping this will be good for both D and Julia, allowing library developers to reach a broader audience, and library consumers greater flexibility. I'll post on the D "announce" thread when I have something working, and I'd definitely appreciate tests/bug-reports at that time!
Dec 11 2014
On Friday, 12 December 2014 at 06:57:24 UTC, Laeeth Isharc wrote:I guess you can call D from Julia very easily via the C API and would just need to declare C calling convention in your D code. It may be that with a combination of Julia and D one has the best of both worlds - no compromise with speed and efficient resource use on the number crunching with a nice shell / Ipython notebook that is still pretty fast on the front end. Nicer would be a wrapper a la PyD that seamlessly translates between types. Then the other thing is to translate julia.h into D so that you can embed Julia. That's a little work but not so hard. More about how this works with C here: http://docs.julialang.org/en/release-0.3/manual/embedding/That's interesting. I hadn't seen it before. I communicated with John Myles White via Twitter some months ago, and he said shared libraries for Julia should be coming. That would mean you could compile Julia functions and call them directly from D. This type of embedding is what you get with, say, Guile Scheme. The shared library approach would be a lot more convenient.
Dec 12 2014
The downside about calling embedding Julia is C is that everything's a pointer to the heap and you have to manually call the garbage collector. If the same thing were implemented in D, then D can handle the garbage collection as per normal. It seems like D is a better fit for Julia than C in that regard. On Friday, 12 December 2014 at 06:57:24 UTC, Laeeth Isharc wrote:On Wednesday, 7 May 2014 at 14:57:36 UTC, Chris wrote:On Wednesday, 7 May 2014 at 12:05:10 UTC, bachmeier wrote:I guess you can call D from Julia very easily via the C API and would just need to declare C calling convention in your D code. It may be that with a combination of Julia and D one has the best of both worlds - no compromise with speed and efficient resource use on the number crunching with a nice shell / Ipython notebook that is still pretty fast on the front end. Nicer would be a wrapper a la PyD that seamlessly translates between types. Then the other thing is to translate julia.h into D so that you can embed Julia. That's a little work but not so hard. More about how this works with C here: http://docs.julialang.org/en/release-0.3/manual/embedding/On Wednesday, 7 May 2014 at 09:16:01 UTC, Chris wrote:Would be cool if we had something like this for Julia (if it really catches on).On Tuesday, 6 May 2014 at 23:19:47 UTC, Mason McGill wrote:It's really easy to do that with R. There is a package RInside that makes it trivial to embed R in a C++ program, and it's not difficult to use with D.On Tuesday, 6 May 2014 at 11:28:21 UTC, Chris wrote:I was also thinking in the direction of enabling D to use existing Julia code seamlessly, so you can just call it from D (extern(J)), and maybe even efficiently compile it into binaries along with D code, as you would with extern(C) calls now.Maybe it's time to think about a D interface to Julia. If Julia catches on within the scientific community, it would be good to have a foot in the door. Science quickly creates large code bases, unfortunately, so far it's mostly Python and Matlab which makes it hard to use the algorithms in real world applications.I've actually been working on just that, on and off for a few months now. Such a thing is kind of "anti-Julian", though, since one of Julia's main goals is to reduce or eliminate the need for mixed-language projects. However, with D, you can compile small shared libraries that can be automatically bound to your users' favorite dynamic runtimes (via compile-time reflection). I'm hoping this will be good for both D and Julia, allowing library developers to reach a broader audience, and library consumers greater flexibility. I'll post on the D "announce" thread when I have something working, and I'd definitely appreciate tests/bug-reports at that time!
Jan 13 2015
On Tuesday, 6 May 2014 at 11:20:33 UTC, Paulo Pinto wrote:On Tuesday, 6 May 2014 at 09:11:30 UTC, Chris wrote:Excellent summary, one quibble, you omit MATLAB and Octave users from your target audience, when they may be the most important one. Julia reads much more like MATLAB than like R or Python, and numerical linear algebra is one of the things Julia is being aimed at. It has a very rich language of types, and a macro system. Disappointingly, whilst you can annotate function arguments and variables with types, you can't annotate the function itself with a return type. TL;DR MATLAB reimagined by Lisp hackers. I like it! Not really competing in the same space as D. Yes, I know, I'm pigeonholing D, which is supposed to be a wide spectrum language, etc. etc.I recently came across this article http://www.wired.com/2014/02/julia/. On the Julia homepage there are some benchmarks times relative to C. I know that bearophile has mentioned Julia several times on this forum. Has anyone compared D's vs Julia's performance as well as design features?I can only comment on design features. You can think of Julia as a dynamic language similar to Python, with optional typing and for such a young language, a quite good JIT compiler backed by the LLVM backend. It is a multi-paradigm language, with an OO approach based on multi-methods and direct support for scientific programming. The target audience are the scientifc community that makes use of R, Python with NumPy and so on, which are currently disappointed with the performance of said systems. Their goal is to keep the programming flexibility of R and Python, while improving the performance without having to be forced to write C code.
May 06 2014