The feel of Python with the performance of C

The feel of Python with the performance of C

Why does Jow Forums like Java?

Attached: nim.jpg (690x460, 58K)

Other urls found in this thread:

pypy.org/
ziglang.org/
youtu.be/7uLzaKlZSQQ?t=78
fmtlib.net/latest/index.html
pastebin.com/FDNxQq9c
nim-lang.org/araq/ownedrefs.html
vlang.io/
twitter.com/SFWRedditImages

Counterpoint: it's named "Nim" which sounds stupid. Nimrod. Nimnuts.

Java and Python are worse languages but have good names.

the original name of the language was actually Nimrod

okay continue using java faggot

Looks like shit.

Like Terry used to say:
>Some NIGGER came up with this
> cout

But python feels like shit though

Attached: : witness me.jpg (745x582, 65K)

>The feel of Python with the performance of C
pypy.org/

>the feel of Python
Why would I want that?
>the performance of C
le C is teh fasterest meemee XD

>performance of C

Attached: s_0.jpg (300x222, 10K)

it literally compiles to C

Based Terry.

Check zig
ziglang.org/

The feel of C, the speed of C, the access to C libs without the 50 years of cruft and outdated language features.

so then it impossible for it to be faster than C

Your fortune: Good Luck

that's a weird statement. You could write two C programs that output the same stuff with varying speeds, depending on how you implement it. With Nim it compiles to either C or JS, and it optimizes the code so it's faster than most hand-written implementations.

youtu.be/7uLzaKlZSQQ?t=78

call me when it has the performance of rust

How dare you! Nimrod was a mighty hunter! You only think Nimrod is an insult because you watched Bugs Bunny. You've just made an enemy of all pious Christians, Jews, and Muslims.

I was writing some couts the other day and terry is fucking right
it's so cancer compared to a simple printf

Shut up, nigger nimrod.

Use libfmt, it'll probably be standardized soon enough. Pretty much like printf but type-safe (why specify types in the format string when the compiler already knows the types supplied).

fmtlib.net/latest/index.html

>With Nim it compiles to either C or JS, and it optimizes the code so it's faster than most hand-written implementations.
Basically bullshit for any non-trivial benchmarks. Writing any generic transcompiler is going to be hard pressed to improve on hand written code in the language.
If it were so easy to just compile to efficient code auto-magically then declarative languages would have already replaced imperative ones.

I don't want to go back to Python.

Strong typing with type inference, null safety, immutable variables, parallel coroutines, that was the real deal.
>tfw no love for Kotlin
Rust is cool too I guess.

Attached: 1465929875849.jpg (645x773, 87K)

I like Kotlin too, brother. The written efficiency of Python with the typed effectiveness of Java.

I like crystal better.

or - counterpoint - i could just keep using c

>and it optimizes the code so it's faster than most hand-written implementations
Hello world literally compiles to 3000 lines of C

Jow Forums doesn't like Java though

fuck i didn't want to fuck with this fucked up nigger shit language but i need to see if its really so fucking bad as you say. Terry fucking damnit fuck

holy fucking christ you exaggerated but your point stands. lets check it out.

/* Generated by Nim Compiler v0.18.0 */
/* (c) 2018 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, amd64, gcc */
/* Command for C compiler:
gcc -c -w -I/nix/store/j5l7z5bbfyha7gny6kyflg540nszl0kn-nim-0.18.0/lib -o /home/zenojis/nim/nimcache/helloworld.o /home/zenojis/nim/nimcache/helloworld.c */
#define NIM_NEW_MANGLING_RULES
#define NIM_INTBITS 64

#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef powerpc
#undef unix
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NimStringDesc* tyArray_nHXaesL0DJZHyVS07ARPRA[1];
N_NIMCALL(void, echoBinSafe)(NimStringDesc** args, NI argsLen_0);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, setStackBottom)(void* theStackBottom);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, stackOverflow_II46IjNZztN9bmbxUD8dt8g)(void);
static N_INLINE(void, popFrame)(void);
NIM_EXTERNC N_NOINLINE(void, systemInit000)(void);
NIM_EXTERNC N_NOINLINE(void, systemDatInit000)(void);
NIM_EXTERNC N_NOINLINE(void, NimMainModule)(void);
NIM_EXTERNC N_NOINLINE(void, helloworldDatInit000)(void);
extern TFrame* framePtr_HRfVMH3jYeBJz6Q6X9b6Ptw;
STRING_LITERAL(TM_dXO2cnGOaoQkOelZZLCV1Q_3, "Hello Jow Forums!", 12);
NIM_CONST tyArray_nHXaesL0DJZHyVS07ARPRA TM_dXO2cnGOaoQkOelZZLCV1Q_2 = {((NimStringDesc*) &TM_dXO2cnGOaoQkOelZZLCV1Q_3)}
;

static N_INLINE(void, initStackBottomWith)(void* locals) {
setStackBottom(locals);
}
void PreMainInner(void) {
systemInit000();
helloworldDatInit000();
}

void PreMain(void) {
void (*volatile inner)(void);
systemDatInit000();
inner = PreMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}

int cmdCount;
char** cmdLine;
char** gEnv;
N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}

N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}

int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}


static N_INLINE(void, nimFrame)(TFrame* s) {
NI T1_;
T1_ = (NI)0;
{
if (!(framePtr_HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA4_;
T1_ = ((NI) 0);
}
goto LA2_;
LA4_: ;
{
T1_ = ((NI) ((NI16)((*framePtr_HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1))));
}
LA2_: ;
(*s).calldepth = ((NI16) (T1_));
(*s).prev = framePtr_HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr_HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) 2000))) goto LA9_;
stackOverflow_II46IjNZztN9bmbxUD8dt8g();
}
LA9_: ;
}

static N_INLINE(void, popFrame)(void) {
framePtr_HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr_HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
NIM_EXTERNC N_NOINLINE(void, NimMainModule)(void) {
nimfr_("helloworld", "helloworld.nim");
nimln_(1, "helloworld.nim");
echoBinSafe(TM_dXO2cnGOaoQkOelZZLCV1Q_2, 1);
popFrame();
}

NIM_EXTERNC N_NOINLINE(void, helloworldDatInit000)(void) {
}

>The generated code is subject to the original license
What did they mean by this? Is every program generated by this garbage forcibly licensed under whatever license nim is using?

they mean the license of the code you fed the compiler, your license.

ABSOLUTELY BTFO

nimShills BTFO

your programmer license please

Looks cool but it's not even bootstrapping yet.

It gets more interesting if you dig in though. Using glibc vs nim, it looks like the preprocessed C is actually shorter in nim, but only marginally.

helloworld.c is from nim
hello_world.c is this:
#include

void main(){
printf("Hello Jow Forums!\n");
}


gcc -E hello_world.c | grep -v -E '(^$|^# [[:digit:]]+ ".+".*$)' | wc
297 1578 13058


(manual include needed because I'm using Nix)
gcc -E -I/nix/store/j5l7z5bbfyha7gny6kyflg540nszl0kn-nim-0.18.0/lib ./helloworld.c | grep -v -E '(^$|^# [[:digit:]]+ ".+".*$)' | wc
150 517 4873

the pipe through grep is to strip out comments and blank lines

next, lets check out the assembly...

gcc -S hello_world.c
.file "hello_world.c"
.text
.section .rodata
.LC0:
.string "Hello Jow Forums!"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl $.LC0, %edi
call puts
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (GNU) 7.3.0"
.section .note.GNU-stack,"",@progbits

gcc -S -w -I/nix/store/j5l7z5bbfyha7gny6kyflg540nszl0kn-nim-0.18.0/lib ./helloworld.c
.file "helloworld.c"
.text
.section .rodata
.align 32
.type TM_dXO2cnGOaoQkOelZZLCV1Q_3, @object
.size TM_dXO2cnGOaoQkOelZZLCV1Q_3, 32
TM_dXO2cnGOaoQkOelZZLCV1Q_3:
.quad 12
.quad 4611686018427387916
.string "Hello Jow Forums!"
.zero 3
.globl TM_dXO2cnGOaoQkOelZZLCV1Q_2
.align 8
.type TM_dXO2cnGOaoQkOelZZLCV1Q_2, @object
.size TM_dXO2cnGOaoQkOelZZLCV1Q_2, 8
TM_dXO2cnGOaoQkOelZZLCV1Q_2:
.quad TM_dXO2cnGOaoQkOelZZLCV1Q_3
.text
.type initStackBottomWith, @function
initStackBottomWith:
.LFB2:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movq %rdi, -8(%rbp)
movq -8(%rbp), %rax
movq %rax, %rdi
call setStackBottom
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc

i cant post all the assembly here because it's long and outrageous, so heres the pastebin pastebin.com/FDNxQq9c
The assembly from nim is 10x+ longer. 27 lines with standard C vs 284 from nim

>With Nim it compiles to either C or JS, and it optimizes the code so it's faster than most hand-written implementations.
your move man

Attached: 1442765966497.jpg (298x297, 20K)

line 199
.L16:
nop


the fuck is the point of this label?

>Writing any generic transcompiler is going to be hard pressed to improve on hand written code in the language.
>implying that it's any different from C-machine compiler

> didn't see the posts that showed the "optimizations"

you're missing the point user
-C compiles shit Assembly
-if you are in Nim, which will compile shit-C, which will compile shittier Assembly
What benefit do you get from Nim that you don't already get in C?

Are the devs of nim trying to improve this or no?

it's an optimization. instead of just putting it a noop it jumps to a noop. There are actually two of these in there. L15 and L16. You just don't understand it because you've been drinking the glibc koolaid all your life

>Why does Jow Forums like Java?
Nice falseflagging, moron

...

but nim transpiles to c. going from nim->c->machine

>instead of just putting it a noop it jumps to a noop

Attached: 1442304236307.jpg (1024x569, 109K)

To be fair you should count the number of instructions generated after compiling. Most of those lines are macros which don't generate any instructions. Though there are some procedure calls too.

Attached: 1524352599801.gif (500x418, 885K)

Nim is master-race tier

Nim is written by a single man, with all the idiosyncrasies stemming from this fact. It literally has the bus factor of 1, and will never be able to put as much effort as other languages with big teams, like Rust and Kotlin, do. I mean, he's basically cheating by using C as the backend, instead of LLVM, but it will only get him so far. Besides, right now the author has a huge case of Rust envy so he invents shitty half-baked solutions only to be able to put NO GC on the front page, just like the big boy Rust does: nim-lang.org/araq/ownedrefs.html .

There's also v vlang.io/ (not to be confused with another v language). Compiles to C but generates very fast C. This one I really hope isn't vaporware.

>the feel of python
lmao we're not masters psyc students that need to learn a bit of programming to pass some shitty course

Unironically this. Nim is promising (if they can figure out their compiler--I've run into some truly asinine, intro-to-compilers-project tier compiler bugs. But that name. It will sink them. And it sucks. Nim is almost as bad as Nimrod.

Call it [literally anything]script, but why fucking Nim? Imagine telling your waifu about the big project you're developing with...Nim. Woof.

Java unironically has the best standard library in the biz and isn't unpleasant to develop with. This meme needs to die.

t. stooged for corporate america for a few years

call me when Rust's brainlet core devs get around to a fucking regex module. or when Redox isn't a total affront to systems programming.

you guys are the fucking worst. such hubris and delusion.

I gave it a shot. Too buggy, too half-baked right now. Promising, however.

Anyways: D is the future, we're all just late.

What's wrong with Rust's regex?

I didn't know bugs bunny was so based and redpilled

it is not production ready though

java is nothing like python

>feel of Python
wrong
>with the performance of C
wrong
>does Jow Forums like Java?
it doesn't

Attached: 4131022_orig.jpg (333x500, 126K)

>The feel of Python
It looks like pascal and nothing like python, you fucking nimmer.

RIP Harambe

Worst thing about python is the syntax, why would anyone make something like it??

the worst thing about python is the brainlet guido van rossum