World: r3wp
[World] For discussion of World language
older newer | first last |
Geomol 6-Dec-2011 [417x2] | (And I thought, LLVM was much better, but maybe I do something wrong or miss some option!?) |
Porting to LLVM took less than an hour. It's mainly changes, because LLVM is very strict about types, when checking e.g. unsigned against signed values. etc. | |
Dockimbel 6-Dec-2011 [419] | You mean porting to "clang"? |
Geomol 6-Dec-2011 [420x2] | There is a /usr/bin/llvm-g++ command under OS X. The man page say: llvm-gcc uses gcc front-end and gcc's command line interface. So maybe it isn't "clang"!? I'm not sure. It's my first real experience with LLVM. |
There also is a /usr/bin/clang Maybe I should try compile with that. | |
Dockimbel 6-Dec-2011 [422] | By the way, why haven't you used LLVM for building World? As it is VM-based, LLVM would have been a good match. |
Geomol 6-Dec-2011 [423x5] | Because I had no experience with LLVM, because I started World dev. on older MacBook, because LLVM was many MB download, because I wasn't sure, I could get LLVM on Windows and Linux easily. |
I tried compile with clang. More results, first with gcc, then clang: gcc -O2 option size: 346136 time: 0:00:00.681560 clang -O2 option size: 349976 time: 0:00:00.736821 clang -O3 option size: 354072 time: 0:00:00.643053 clang -O4 option size: 382888 time: 0:00:00.734845 | |
And I notice, at least one of my tests don't finish with the LLVM and clang versions, which is disturbing. :/ | |
So it seems, I made a good choise with gcc, because 1) it was easy to make World compile with LLVM and clang (if I choose that path now) and 2) it seems, some code doesn't work as intended with LLVM and clang. | |
gcc -O3 option size: 362304 time: 0:00:00.579858 It seems, gcc beat LLVM and clang here on performance, if I use -O3 option. | |
BrianH 6-Dec-2011 [428x2] | LLVM isn't really VM-based in the sense that bytecode VMs are. The VM is a compiler backend, but the code it requires tends to have to be specialized a little for the actual machine. As the developers of Portable NaCl have been discovering, it's not necessarily that good at being a portable VM. |
You might also look into LuaJIT, as it is supposedly faster than most VMs, and smaller too. | |
Geomol 6-Dec-2011 [430] | Thanks, Brian (LuaJIT). Could be later, when World is stable and the hunt for performance really starts. |
Dockimbel 6-Dec-2011 [431] | Sure, LLVM is not a "VM", it's a framework for building compilers, interpreters, VMs,...But for a VM-based language implementation, it makes sense to strongly consider the LLVM option. |
Geomol 6-Dec-2011 [432] | Yeah, I've had it in the back of my head all the way with World. And then I just noticed, it was installed on this Mac. |
Andreas 6-Dec-2011 [433x4] | llvm-gcc support has been dropped in the most recent LLVM release (3.0), so definitely use clang whenever you can. |
I don't think that LLVM/Clang claims to be much better in runtime performance over GCC, at the moment. | |
The resulting binaries are, at the moment, generally comparable to GCC-generated ones. GCC is better in some areas, LLVM/Clang in others. | |
However, _build_ times with Clang should be superioer, but that won't matter much for World, I think. Error messages from Clang should also be much better. Esp. for C++, but also for C. | |
Geomol 6-Dec-2011 [437x2] | ok, I think, most believe, LLVM/Clang is about performance. |
So it's more about portability and maybe better error messages? | |
Andreas 6-Dec-2011 [439] | For typical end-users, clang is about fast compilation and good error diagnostics (at the moment). |
Geomol 6-Dec-2011 [440] | ok,thanks |
Andreas 6-Dec-2011 [441] | Clang also explicitly aims at GCC compatibility, so switchting to it from GCC is generally rather easy. |
Steeve 6-Dec-2011 [442] | I'm confused Geomol, you're not aiming LLVM to perform jit within #world but to compile the VM of #world ? |
Andreas 6-Dec-2011 [443] | Yes. |
Steeve 6-Dec-2011 [444] | but... what is the interest, I mean when compared with standard C compilation. |
Andreas 6-Dec-2011 [445] | That is just standard C compilation :) |
Steeve 6-Dec-2011 [446] | uh ! |
Andreas 6-Dec-2011 [447x2] | LLVM/Clang is actually the default toolchain in Xcode4, for example :) |
IIUC, John tried LLVM to see if the resulting binaries would performan better than GCC-compiled ones. | |
Steeve 6-Dec-2011 [449x2] | ah ok, but is there any other motivation behind the scene like to be able to compile code on the fly instead of generationg bytecodes for the VM ? |
I mean LLVM can support JIT or is that another toolchain ? | |
Andreas 6-Dec-2011 [451x2] | LLVM can also be used as a set of compilation libraries, yes. And you can implement a JIT that way, yes. |
But they also provide a set of ready-built binaries which work as a nice AOT compiler for C/C++/ObjC. I.e. just like GCC or MSVC or ICC or ... | |
Kaj 6-Dec-2011 [453] | John, you may want to try -Os. Optimising for size often leads to best speed, too, on modern architectures due to caching efficiency. OS X is also compiled that way |
Geomol 7-Dec-2011 [454x2] | Thanks, Kaj. I will try that. Steeve, it was just to try another compiler. |
World should accept REBOL [] as header to run R2, R3 scripts through it without editing these. For now, it's possible to run REBOL scripts with this function: do-rebol: func [file][do skip load file 2] | |
BrianH 7-Dec-2011 [456x2] | R3 scripts only require the REBOL header if they're modules/extensions. |
Or when you want to put documentation before the header, or embed the script in a block in another type of file. | |
Geomol 7-Dec-2011 [458] | Ok, worth to consider. |
BrianH 7-Dec-2011 [459] | That's why you don't need to write the REBOL header at the command line, even though those commands are just passed to DO like any other script :) |
Geomol 7-Dec-2011 [460x5] | Kinda the same in World with the command line. |
New release at https://github.com/Geomol/World | |
- Gave series an overhaul, so compiling blocks should really work now. Let me know, if it doesn't. - Changed system/version/platform, so it's now a word. - Added new tests. | |
When compiling blocks, each block instance has its own compiled code. And changing at one instance doesn't reset compilation for another (which would else add overhead). So: w> s: [1] == [1] w> do s == 1 w> t: tail s == [] w> insert t 2 == [2] w> do t == 2 w> s == [1 2] w> do s == 1 APPEND doesn't change at the block instance, so APPEND doesn't reset compilation. | |
Block compiled state will be reset by functions such as INSERT and REMOVE. And if the block is set to another location (NEXT/BACK with call-by-word for example). | |
Oldes 7-Dec-2011 [465] | What would be World's equivalent of this: with: func[obj body][do bind body obj] |
Geomol 7-Dec-2011 [466] | You found a bug! :) Uploading fix ... |
older newer | first last |