Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

So I see many of you around here use

Name: Anonymous 2014-11-18 17:53

assembly. Is it just trollin' for /prog/, or do you actually perform your general-purpose programming in assembly? Is it really feasible to be a productive programmer by using just ASM?

Name: Anonymous 2014-11-18 19:08

It's feasible to write solutions to Project Euler exercises in ASM. It's also feasible to write simple games. But mostly you want to leave register allocation to the compiler, so by writing ASM directly you are probably shooting yourself in the foot. At least use something slightly higher level like LLVM IR.

Name: Anonymous 2014-11-18 19:24

>>2
Well, LLVM IR was my next question. Have you actually written anything non-trivial in raw LLVM IR?

Name: Anonymous 2014-11-18 19:46

Name: Anonymous 2014-11-18 19:56

>>3
I haven't even written anything trivial in LLVM IR. It was just an example of something slightly less stupid than writing ASM.

Name: Anonymous 2014-11-18 19:58

>>1
Is it just trollin'
No, serious business.

do you actually perform your general-purpose programming in assembly?
No, that wouldn't make any sense. However, this should not prevent from discussing about assembly.

Is it really feasible to be a productive programmer by using just ASM?
No.

Still, I think every programmer should learn assembly.

Name: Anonymous 2014-11-18 20:52

K, thanks.

Name: Anonymous 2014-11-18 21:13

OP, don't listen to them. Bytefucking is for idiots. I've compiled my 135-byte Haskell source file

module Foo where

foo :: [Int] -> Double
foo xs = loop xs 0.0
where
loop [] a = a
loop (x : xs) a = loop xs (a + fromIntegral x)


to LLVM IR and it took fucking 22 kB. This is more verbose than Ada. Fuck, better learn Ada and write in that, than waste your time on assemblies. The only thing good about assembly is that you'll become a better speed-typist.

Name: Anonymous 2014-11-18 21:18

22 kB
Are you kidding me? Cudder could do it in less than 500 bytes.

Name: Anonymous 2014-11-18 21:23

>>9
So half of this is useless or what? I've selected just a pinch of that barf but it's over 900 symbols:

define cc 10 void @Foo_foo_info(i64* noalias nocapture %Base_Arg, i64* noalias nocapture %Sp_Arg, i64* noalias nocapture %Hp_Arg, i64 %R1_Arg, i64 %R2_Arg, i64 %R3_Arg, i64 %R4_Arg, i64 %R5_Arg, i64 %R6_Arg, i64 %SpLim_Arg) align 8 nounwind section "X98A__STRIP,__me6"
{
c16u:
%ls15H = alloca i64, i32 1
%Hp_Var = alloca i64*, i32 1
store i64* %Hp_Arg, i64** %Hp_Var
%lc160 = alloca i64, i32 1
%ls15K = alloca i64, i32 1
%ls15J = alloca i64, i32 1
%Sp_Var = alloca i64*, i32 1
store i64* %Sp_Arg, i64** %Sp_Var
%R2_Var = alloca i64, i32 1
store i64 %R2_Arg, i64* %R2_Var
%R1_Var = alloca i64, i32 1
store i64 %R1_Arg, i64* %R1_Var
%ln18y = load i64* %R2_Var
store i64 %ln18y, i64* %ls15H
%ln18z = load i64** %Sp_Var
%ln18A = getelementptr inbounds i64* %ln18z, i32 1
%ln18B = ptrtoint i64* %ln18A to i64
%ln18C = sub i64 %ln18B, 24
%ln18D = icmp ult i64 %ln18C, %SpLim_Arg
br i1 %ln18D, label %c16v, label %c16w

Name: Anonymous 2014-11-18 21:31

>>9
Is that just summing a linked list of doubles? That's like... less than 30 bytes.

(Check 'em.)

Name: Anonymous 2014-11-18 21:33

>>11
Not just summing, gotta convert them to doubles first.

Name: Anonymous 2014-11-18 22:24

>>10
IR is bloat

Name: Anonymous 2014-11-18 22:49

>>10
LLVM is Apple bloat and lock-in. It's a scourge on all programmers and nobody should use it for anything.

OP, learn assembly and learn to be like Mel.

Name: Anonymous 2014-11-18 22:57

>>14
LLVM IR is portable while assembly is not.

Name: Anonymous 2014-11-18 23:22

>>15
Realistically there's only one architecture your code will ever run on.

Name: Anonymous 2014-11-18 23:55

>>15
I can compile assembly into other languages, even other assemblies.

Name: Anonymous 2014-11-19 0:32

Name: Cudder !MhMRSATORI 2014-11-19 4:38

>>12
That doesn't even take any additional instructions with x87.

Assuming next-pointer is first, which saves an instruction or two... and the head is in esi...

linked-list of doubles:
fldz
fooloop:
test esi, esi
jz done
lodsd
fld qword [esi]
faddp
mov esi, eax
jmp fooloop
done:


vs

linked list of ints:
fldz
fooloop:
test esi, esi
jz done
lodsd
fild dword [esi]
faddp
mov esi, eax
jmp fooloop
done:


Why the fuck you'd want to use a linked list for 4 or 8-byte things is the real problem here, but that's what you wanted so that's what you got...

Name: Anonymous 2014-11-19 5:49

The correct answer is because it requires more time to create a program. not because the computer (which it cannot) do register allocation better than me.

huskel niggers confirmed for being low iq nigger worshippers of the nigger machine LOL

Name: Anonymous 2014-11-19 9:08

>>19
>real problem
Shalom!

Name: Anonymous 2014-11-19 17:06

Check out all the doubles I can put in my xmm0 to xmm15 registers

Name: Anonymous 2014-11-19 18:07

>>19
Why the fuck you'd want to use a linked list for 4 or 8-byte things
Haskellers use them even for chars. I.e. Haskell Strings are just linked lists of chars. That's right, 5 words of overhead to store just one byte. Actually, there's even more overhead for lazy Strings (which they are by default), because every char is actually a thunk (a function from () to a char)...

The long story is that in Haskell, linked lists stand for iteration and get compiled to tight loops with no actual list consing... but stream fusion (which is the name for this optimization) didn't really turn out so great, and now most linked lists are just linked lists, bloated and stupid.

Name: Alexander 2014-11-19 19:03

>>20
of the nigger machine
The spineless tagless graph machine is better than you, better than sky, better than even Allah.

Name: Anonymous 2014-11-19 19:50

>>23
The Haskell community is indeed embarrassed by how bad a decision this turned out to be. As it happens, there is a replacement string type (Data.Text) which has way better constant-factor and asymptotic performance characteristics. Sadly, it's not the default, and is not even properly part of the standard library. Maybe in a future version that will change.

Name: Alexander 2014-11-19 20:00

>>25
But Text will need to support pattern-matching syntax for consing and destructuring to be as comfortable as Strings. Which isn't happening in any foreseeable future. And if you can't do foo (x : xs) on a Text, people will continue to use Strings for nearly everything.

Name: Anonymous 2014-11-19 21:30

>>25
constant factors are irrelevant

Name: Anonymous 2014-11-19 22:36

>>27
I have just one question for you, respectable sir: are you a nigger?

Name: Anonymous 2014-11-19 23:49

>>26
You can use view patterns to get close to that

{-# LANGUAGE ViewPatterns #-}
import Data.Text (uncons)

f (uncons -> Nothing) = ...
f (uncons -> Just (x, xs)) = ...

Name: Anonymous 2014-11-20 1:54

>>29
That's really beside the point.

Name: Anonymous 2014-11-20 3:19

>>24
blah blah you cant do easy shit like arithmetic blah blah low iq nigger autist brain damage rofl lol quick whats 2 + 6? quick what is topology? da fuck is a topoloogaboogay, nigga (you)
le huskel high iq genius lol no in reality yet again the high iq programmer is the C machine rapist and the wizardly lisper
gonna go rape your precious nigger machine now, cya nigger

Name: Anonymous 2014-11-20 3:54

>>31
Stop bullying haskell-kun

Name: Anonymous 2014-11-20 11:46

>>31
(General) Topology is fun.

Name: Anonymous 2014-11-20 19:03

>>29
There will never be an extension to turn list-specific pattern matching syntax into a generalized idiom for introspecting sequential data structures. Therefore, Haskell is useless for writing real programs.

Name: Anonymous 2014-11-20 19:57

Roller Coaster Tycoon was written in Assembly and it is BLAZING FAST!!!

Hows that for non-trivial programming?

Name: Anonymous 2014-11-20 19:57

>>27
You, sir, are and idiot. :)

Name: Anonymous 2014-11-20 23:02

>>122
C'
I wish we had a C@ language that compiled to Neko ( ;_;)

Name: Anonymous 2014-11-21 1:01

compile to my anus

Name: Anonymous 2014-11-21 1:40

>>34
Read only access to sequential data can be made to look like list access, but you run into problems when you start consing. The problems aren't unsolvable, however, just a little challenging.

Name: Anonymous 2014-11-22 8:42

>>39
Consing should be desugared to calls to a lazy builder which will be as efficient as consing to a list. Then the Text would be forced only once when the function returns the result.

Don't change these.
Name: Email:
Entire Thread Thread List