[ / / / / / / / / / / / / / ] [ dir / random / 93 / biohzrd / hkacade / hkpnd / tct / utd / uy / yebalnia ]

/prog/ - Programming

Programming
Name
Email
Subject
REC
STOP
Comment *
File
Password (Randomized for file and post deletion; you may also set your own.)
Archive
* = required field[▶Show post options & limits]
Confused? See the FAQ.
Options

Allowed file types:jpg, jpeg, gif, png, webp,webm, mp4, mov
Max filesize is16 MB.
Max image dimensions are15000 x15000.
You may upload5 per post.


File: 55271e1daa3654f⋯.jpg (19.37 KB,334x302,167:151,Morpheus2.jpg)

4a40e5 No.5313

What if i told you you can have a programming language that's simpler than Python and faster than C?

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

fa3d0d No.5314

I'd call you a retard because C isn't inherently fast and Python isn't simple.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

fa3d0d No.5315

Maybe something more to make this a bit less of a shitpost: C looks inherently fast to the layman for two main reasons: First of all, because a typical C program does less than a typical program in another language. In the C world, it is not at all uncommon to say "we only accept MAGIC_NUMBER items at most, you're shit out of luck if you have more" (was more common when "real unix" was still alive); of course such a program will be faster than a program that dynamically adjusts buffers to account for whatever it is fed, because it doesn't do the same thing! I'm not even going to touch on bounds checking and all that because that is well-trodden territory by now, but you should still keep it in mind as well.

Additionally, C's compiler technology is probably the most advanced of all simply because of its age and because many languages are just implemented on top of it. However, C is not even particularly close to the hardware ( https://queue.acm.org/detail.cfm?id=3212479 ) and languages like Pascal which have their own implementation can reach the speed of a C implementation while providing a much saner language.

There is also another big reason C (as a language, rather than an implementation) seems fast: While it makes sense to sacrifice some speed for say debugging features, this is extraordinarily difficult with C because it is specifically defined so that the straightforward implementation (pointer = address, whatever an address is; int = machine fixnum, whatever size that is and whatever overflow behavior it has; ...) is a legal implementation. But that comes at the cost of rather ridiculous abstract semantics that

(a) are difficult to keep up with when you stray from the obvious implementation

(b) are adhered to by basically no program anyway because it's easier to think about the obvious implementation while writing C.

As a result, slower more helpful implementations like this are not written for C, creating the impression that there is something about the language that makes it fast. Well, technically you can argue there is, but for all the wrong reasons.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

4a40e5 No.5316

File: 84161517a6ce90e⋯.jpg (51.34 KB,500x500,1:1,artworks-000454061493-fr7x….jpg)

ok let me rephrase it in a way that won't trigger autists:

what if i told you you can have a programming language that's simpler and faster than any other language?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

ce3ff6 No.5317

>>5316

What do you mean by simple? Do you mean I can get a lot done with little code? Or I'm going to be learning assembly?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

834ce9 No.5318

True. It's called money.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

b8f134 No.5319

>>5316

Speed isn't a property of languages, it's a property of implementations. But tell me more, what did you have in mind?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

cadcd5 No.5321

>>5317

a lot with little code. i see simpler as having to make less decisions (ex: int size, data structure choices, ...).

>>5319

implementations are constrained by the language. for example C++ dictates the order you define member variables is the order they are layed out in memory, thus the compiler isnt allowed to optimize their layout (to minimize padding for example).

you can design a language to take control over things that you can optimize in the implementation.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

ce3ff6 No.5322

File: c30a62d28d2f7f1⋯.jpg (13.22 KB,263x192,263:192,trapcard.jpg)

>>5321

>a lot with little code.

A high level language eh?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

cadcd5 No.5323

>>5322

yeah, is that a problem?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

9adf7a No.5329

I think there are programs that do this. There is software that translates python to C or C++. Then you can compile it to arch of choice then dump the assembly code and do micro-optimizations on ASM. I think if you have a program written correctly it can pretty much run inside of the CPU's registers and caches without much need of outside memory or storage. I'm not sure how to do this but I think it can be done. I was thing about this briefly while I was learning X86_64.

IDK it would be nice to have a language script kiddie easy like python, ruby or BASIC that you can dump to optimal assembly or even shellcode with some scripts.

I think this could be done. We should talk about code a little.

Python 2.7


#!/usr/bin/python
print 'hello world'

X86_64


global _start

section .text

_start:
mov rax, 1 ; write(
mov rdi, 1 ; STDOUT_FILENO,
mov rsi, msg ; "Hello, world!\n",
mov rdx, msglen ; sizeof("Hello, world!\n")
syscall ; );

mov rax, 60 ; exit(
mov rdi, 0 ; EXIT_SUCCESS
syscall ; );

section .rodata
msg: db "Hello, world!", 10
msglen: equ $ - msg

C++


#include<iostream>
using namespace std;
int main()
{
cout<<"Hello World";
return 0;
}

Java


public class HelloWorld {

public static void main(String[] args) {
System.out.println("Hello, World");
}
}

BASIC

Gotta love BASIC


PRINT "Hello World"

I was looking around I found this page: Hello world in 28 languages. https://excelwithbusiness.com/blog/say-hello-world-in-28-different-programming-languages/

/tech/ we should build a translation program that will translate code from one language to another like Google does with languages. Probably actually simpler since you can write most assmebly programs with just 13 or so instructions.

OP I'm not really sure what you had in mind here, but you have my attention, only for a minute because I'm busy.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

a67d85 No.5330

>>5329

It's easy to construct an example like this, but output in many languages (especially if based on C's stdio.h) is buffered and relatively complex, so reductions to a straight syscall are not as simple in general. You'd either need a language whose features map cleanly onto the hardware/OS (which runs either the risk of being tied to a particular setup or the risk of becoming another C where the features are not very useful) or rather advanced full program optimization.

>/tech/ we should

Hey buddy, I think you've got the wrong door. The logo club is two blocks down.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

e59591 No.5331

>>5329

what i had in mind is different, a new language, but what you want to do is achievable with LLVM - compiling a language to LLVM IR and then from the IR to other langs (see Emscripten for example).

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

519868 No.5333

>>5329

Isn't syscall slower than regular int because of all the redundant register pushes?

asking for a friend.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

7f110a No.5357

>>5314

I'm going to call YOU a retard because python is easy as fuck, even a 12 year old can write advanced code understanding the OOP and C is much faster than most languages with an exception of C++.

>>5313

OP, it's LISP or a dialect of it.

Have a nice day.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

32fa5c No.5358

>>5329

>using namespace std;

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

32fa5c No.5359

>>5357

>C++ is faster than C

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

498b36 No.5360

>>5358

Why is this such a cargo cult thing in C++? Nobody sane would explicitly name the standard library for every single thing in a different language, but every C++ programmer parrots this. It makes the code utterly unreadable, especially in small examples.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

9ea4bf No.5362

i found new optimizations that C++ compilers don't do.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

06779b No.5367

>>5360

>uuuuuuuuhhhhhh muh muh reaaddiabluty

yeah sure, fucking christ, you just cant type fast enough

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

1b988c No.5368

>>5367

Did you have a stroke writing this?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

e529a7 No.5369

Nim vs Crystal, prove me wrong

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

c75c79 No.5370

>>5368

>uhhhhhhhhhhh oh no he kno truth!!! what do nwo????

nice ad hominem fag

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

3f54ec No.5381

>>5360

Only do using namespace whatever if you are calling stuff from that library more than a few times. like if I'm writing an image processing program that uses opencv libraries im going to have a ton of things that reference opencv so i would definitely use the namespace for that. for a simple hello world program, however, it isn't necessary. If your calling cout like 3 times in the same program then yeah use using namespace;

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

daeb8d No.5390

File: 885293c728623a4⋯.png (18.53 KB,399x291,133:97,1527731193699.png)

It's dart isn't it!

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

54cb46 No.5394

>>5329

> all those redundant REX prefixes

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

21f180 No.5404

>>5367

Actually programmers spend more time READING their code than writing it. So readability and clean code are really important.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

21f180 No.5405

>>5370

Wut?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

af7b89 No.5413

>>5359

munging together necessarily disparate data types in algorithms that require is almost always faster in C++ than C, using C++'s static polymorphism facility (templates).

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

caed3c No.5416

>>5315

See djb's 'Death of Optimizing Compilers' talk.

Pretty much everything is slow as fuck, 1990s tier. If you want something 'fast' you have to hand optimize ie: write your own assembly. Once upon a time these 1970s computer scientists like Dijikstra realized there should exist a high level programming language where you can hand roll compiler optimizations in the high level language, with some kind of special annotations or something. Nobody bothered to do so and so we are stuck with hand optimization in (current year).

That said new languages are coming out all the time in specialized industry, we just don't hear about them like domain specific network programming languages done in probability 'paradigm' languages where you can do annotations for compiler optimizations but they're domain specific, so unless you're into massive networking you haven't heard of them.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

bf42ed No.5425

>>5416

domain specific languages are a meme and virtually always could have been written as a library.

the nature of computing doesn't change when you change the problem domain. all these DSLs still compile to run on the same architecture, proving there's nothing different.

Why people create them?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

470cf9 No.5432

>>5425

In order to make use of domain specific features as matters of convenience and productivity. The theory of Turing completeness means that the functionality will be equivalent in the end. That doesn't mean that the programming effort to reach that point is equivalent.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

dacacb No.5443

>>5432

that's a fallacy.

as i already said same can be achieved with a library.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

3429c3 No.5444

>>5315

>C's compiler technology is probably the most advanced of all

LOL. Fortran has been far ahead of C forever. They just finally got a major optimization into C compilers on par with Fortran and there are others.

IIRC they also got Common Lisp (CMUCL?) on par with Fortran for some numerical compilations ages ago and kept it for a little while.

No specific memory but I bet Java got up there pretty good.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

f3bc26 No.5456

File: 610d1b36249c183⋯.png (501.14 KB,9611x2167,9611:2167,static_graph.png)

next milestone is first step in automatic concurrency

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

80ef2f No.5489

File: 666471a32e92c87⋯.gif (777.57 KB,300x100,3:1,4311mj.gif)

I would be happy

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



[Return][Go to top][Catalog][Nerve Center][Random][Post a Reply]
Delete Post [ ]
[]
[ / / / / / / / / / / / / / ] [ dir / random / 93 / biohzrd / hkacade / hkpnd / tct / utd / uy / yebalnia ]