[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Which is the slowest programming language?
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 72
Thread images: 6
File: orly.jpg (50 KB, 485x728) Image search: [Google]
orly.jpg
50 KB, 485x728
Which is the slowest programming language?
>>
>>53535445
Bash or BeanScript or something like it.
>>
>>53535445
Visual Basic is quite slow and shit
>>
English
>>
I'd say BF or some other esolang
>>
ASM, because It takes years to write simple shit.
>>
>>53535445
Define.

Because java is slow to write because it's needlessly verbose and adheres to arbitrary academic rules of OO

Python and ruby are slow to run, in some cases, but much faster to write.

C is fast to write and to run, if you think about your choice ahead of time and understand pointers. It's slow to debug though. C++ hellishly so.
>>
>>53536657
actually the fastest
>>
>>53535666
No, it's actually fast and compiled.
Maybe you think of VBS or VBA?
>>
I'm going to guess a non-tokenized, interpreted BASIC dialect.
>>
Slow to write a program, slow to compile, or slow execution time? Pick one.
>>
Java
>>
>>53535445
Prolog
>>
>>53538085
Those homecomputer things? Definitely.

On the other hand, that's how bash works, but language constructs like if are extra processes so it causes even more performance hits.
>>
File: bigint.png (6 KB, 640x496) Image search: [Google]
bigint.png
6 KB, 640x496
>>53535445
PHP
>>
>>53536729
>It's slow to debug though.
Assuming you're not using gdb. In which case, it's your own fault.

gdb offers more debugging features in C than most enterprise IDEs offer in their meme OOP bytecode garbage.
>>
>>53538272
>but language constructs like if are extra processes so it causes even more performance hits.
They really aren't. Language constructs are built into the shell, and even commonly used commands are built directly into the shell as well.
>>
>>53538305
Based GHC actually produced faster code than the native C version of the equivalent GMP calls.

(Because Haskell's purity allowed it to do some optimizations that C compilers can't)
>>
Tcl is slow as shit.
>>
>>53538329
Then why do I find if in my bin folder and why has if retarded significant whitespace?
>>
>>53536735
C is the fastest unless you can win the compiler at efficiency
>>
>>53538305
What is this benchmarking?
>>
>>53538376
Historical reasons.

None of those binaries aren't used in a modern shell. Don't believe me? Delete them.
>>
>>53538419
http://www.wilfred.me.uk/blog/2014/10/20/the-fastest-bigint-in-the-west/

The language's built-in bigint performance. PHP is slow because it literally converts its bigints to strings and does base10 arithmetic.

(This is because intellectually, PHP's developers are still stuck in kindergarten and don't know any better)
>>
>>53538442
I... I...
What?
>>
>>53538449
Nobody would do this.
Nobody.

How is PHP taken seriously by anyone? The core devs are so fucking idiotic and the language is already broken beyond belief.
>>
>>53538464
>PHP
>taken seriously by anyone
[citation needed]
>>
Javascript.
>>
>>53538464
Why do you think everybody keeps making fun of PHP? It's not just some joke gone too far. The language is _that_ bad.
>>
>>53538533
Well, my idiotic shitcompany does. I keep explaining to them how fucked up this language is and how it has no chance of ever being fixed for billions of reasons, but they insist on starting new projects in it.

God I love how every request takes over 100ms to complete, no matter how basic.
>>
>>53538362
It was optimized since one of the newer versions, though, so I think it's on par with Python, Perl and other craplangs like that.
>>
>>53535445
What about XSLT?
>>
File: 2016-03-17-00-11-43--455350896.jpg (7 KB, 279x181) Image search: [Google]
2016-03-17-00-11-43--455350896.jpg
7 KB, 279x181
>>53535445
Assembly, C, C++
>>
>>53535445

C

Because if it's 3 lines of code in any other language, it's at least 15 lines in C.
>>
>>53538663
>implying longer isn't better
>>
>>53538663
lines aren't a scale of characters and C is fast in executation
>>
>>53538403
anyone remotely competent can easily beat a C compiler
>>
>>53538663
[
public class X {
public static void main(String[] args) {
System.out.println("Hello");
}
}
[/code]
#include <stdio.h>
void main() { puts("hello"); }
>>
>>53536657
Well, brainfuck takes also ages to learn and write
>>
>>53538663
How would you write this in your favorite programming language?

// sum.c
#include <stdio.h>

int main() {
int in, sum = 0;
while (scanf("%d", &in) == 1)
sum += in;

printf("Sum is: %d\n", sum);
}
>>
probably malbolge. both for prorgramming time nad run time efficieny
>>
>>53538781
I gave it a try in standard Haskell

import Text.Read (readMaybe)

main = do
input <- getContents
let s = sum [ n | l <- lines input, Just n <- [readMaybe l] ]
putStrLn $ "Sum is: " ++ show s


Probably a billion ways to improve it that I'm too dumb to think of right now.
>>
>>53538865
Oh, not the same thing as the C version. It should be ‘words’ instead of ‘lines’ inside the list comprehension.

Here's a lens one-liner version of the summing bit:
sumOf (worded._Show) <$> getContents
>>
>>53538781
,[>--------[+<------>]<[->>+
<<],]>>>++++++++++<[->-[>+>>
]>[+[-<+>]>+>>]<<<<<]>>>>+++
+++++++++[-<++++<++++>>]<.<.

input: 123921
output: 18

>>53538865
both haskell and C solutions are longer than brainfuck, kek. are you even trying
>>
>>53538960
Wrong result compared to the C and Haskell versions.

λ ~/dev/haskell/brainfuck/brainfuck sum.bf
123
456
D1%
>>
File: i seent it.jpg (1 MB, 1920x1080) Image search: [Google]
i seent it.jpg
1 MB, 1920x1080
>>53538305

I just cant believe people use php in 2016
>>
>>53538977
it only inputs and adds digits, outputs a two digit number.

rest is simly a scaling problem
>>
>>53538998
"scale" it first and then we'll talk
>>
Brainfuck or similar variants, everything runs in exponential time
>>
>>53538718

Developer time is expensive, micro optimization (at the cost of security and stability) is not interesting in 99.5 % of all cases.


>>53538773

I think you forgot to use free() here and now your memory is leaking.


>>53538781

Oh my, it's rare to see C code that's not weakly typed..

What if I entered "abc" here?
Of course you could throw an exception and.. oh, sorry, you don't have such "sophisitcated" stuff.
>>
>>53539022
I don't have the time, but I imagine it would quadruple the amount of code. Still not that huge.
>>
File: rekt.gif (3 MB, 499x336) Image search: [Google]
rekt.gif
3 MB, 499x336
>>53539027
>>
>>53538998
>rest is simly a scaling problem
That's a weak excuse. You haven't solved the problem. I did not ask for a program that adds characters, I asked for a program that reads characters, converts them to base 10 integers, adds those, and outputs them in base 10.
>>
>>53536729
>java is slow to write because it's needlessly verbose and adheres to arbitrary academic rules of OO
could you give some examples? Java is far from a pure OO language and most of the verbosity comes from a strong type system. it's verbose maybe compared to something like Scala, but you must be out of your, mind if you think C is faster to write than Java
>>
>>53539141
eh, will try it. keep the thread alive for next 15 minutes :P
>>
>>53539027
>What if I entered "abc" here?
λ ./a.out 
abc
Sum is: 0
>>
File: 1456727568353.gif (1 MB, 268x274) Image search: [Google]
1456727568353.gif
1 MB, 268x274
>>53538442
>>
>>53538781
>>53538865
>>53538946
Minor nitpick: Not exactly the same behavior.

The C version stops the loop (and prints the output) when it encounters a non-digit character. The Haskell version just skips over invalid words.
>>
>>53539250
The C version will also parse something like “1 2a” and sum them up to 3, whereas the Haskell version would sum that up to 1.

Still, it's not clear from the context what the program should do in the event of the input not corresponding to the expectation, so I'll assume that's undefined behavior.
>>
>>53535666
You can't fool me satan
>>
> Which is the slowest programming language?
JS
>>
>>53535727
>can program hundreds of years of history with a few lines
>>
>>53535445
This one
https://m.youtube.com/watch?v=t4e7PjRygt0
>inb4 ROOL TOO
>>
>>53535727
Nice try, Zhang.
>>
>>53538305
Is that HHVM or PHP 7? If you don't know, obviously I'm wasting my time.
>>
>>53542867
It's PHP 7
>>
>>53538442
Cherrypicking is bretty cool family. Can you do a benchmark on string manipulation?
>>
GNU octave
>>
>>53536657
no, you're just a fucking retard. People who don't know at least one assembly language shouldn't even call themselves computer scientists
>>
>>53542904
But it says PHP 5.6
There was a proposal to implement native long integers on PHP 7, but it was dropped.
>>
>>53542911
Not him but I just found out about a shootout benchmark for thread switching overhead

https://benchmarksgame.alioth.debian.org/u64q/performance.php?test=threadring

I expected GHC to perform very well on this because GHC has pretty much the best thread scheduler in existence, but I was still impressed.
>>
>>53542962
Oh, you're right - the article links to a commit ID of PHP 7 so I figured it was from the same commit they were testing.

Never figure.
Thread replies: 72
Thread images: 6

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.