Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Bruegels Fuckbooks posted:

But.... why? Why the gently caress?

A massive chunk is generated, if that helps you start working through it.

Adbot
ADBOT LOVES YOU

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Subjunctive posted:

You wouldn't believe me if I told you.

I'd believe you.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Suspicious Dish posted:

I'd believe you.

Nobody would believe that you believed me.

E: Though really, Chrome is 70MB and *Twitter* is 60MB. Apps are big.

Subjunctive fucked around with this message at 03:11 on Aug 16, 2015

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Subjunctive posted:

Nobody would believe that you believed me.

E: Though really, Chrome is 70MB and *Twitter* is 60MB. Apps are big.

I still remember having a 14.4 modem, 500 mb hard drive and 75 mhz processor. This new world is loving scary.

Linear Zoetrope
Nov 28, 2011

A hero must cook
Hell, I just built Hello, World in rust with Release flags and it's 2.4MB, though that links the standard library. Even a C file with only an empty main function is 124KB after compiling it.

Linear Zoetrope fucked around with this message at 03:25 on Aug 16, 2015

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

"How is the FB app so big? It has lots of code in it."

Thanks, post. I couldn't have guessed that much myself.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Knowing how big our app is, I'd believe it. Though just skimming the class names, 90% of them are some kind of _FB*MutationCall, which I presume is either autogenerated classes from an API definition, or it's just architected with a large number of small subclasses for those operations instead of expressing the differences between them in some other fashion.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Is there something special about Java classes that makes them so heavy-weight in terms of code size?

brap
Aug 23, 2004

Grimey Drawer
Those are Objective-C classes.

It seems that any problem expands to fill the limits of its constraints. It does not matter how much hardware muscle is really needed to post cat pics and send messages with your friends (which, by the way, is apparently such a massive undertaking that it requires a separate app). People will use every bit available if they have enough engineers.

This is why I only use Facebook in the browser. I do not need this making GBS threads up my phone.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
The real answer is that performance costs money (in that it costs programmer-hours and you're paying those programmers for those hours). The first bits of performance improvements are very cheap (because they're local changes like "adding a cache" or "not doing this really dumb thing here"), the very last bits are very expensive (because they require structuring your app in such a way that makes all your future changes take longer to do). As computers get faster, the need to spend that money on performance decreases.

It's not that people want to use every last computing resource - it's that optimizing an app to use less resources than is available is much lower priority than most other things you could do with that amount of programmer time.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Often more important, optimization is time, meaning that the thing you're building gets to market later.

But also, there is often a choice between spending code size, runtime speed, or data transferred. If we can write some code to ship cover image previews in 200 bytes versus blank until the extra full request finishes, we're gonna write that code. Similarly, if shipping another image decoder lets us shave a bit off every photo people download, we're gonna ship that decoder and the glue code to go with it. (See also SPDY and such meaning another network stack.) Code size is the least precious resource, way less important to conserve than network latency or data, programmer time, user-perceived performance, reliability, or developer productivity. Until you run out of it, of course...

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
Getting the fat bundle to fit under 100mb *was* a bit of a time sink.

Hughlander
May 11, 2005

Subjunctive posted:

Often more important, optimization is time, meaning that the thing you're building gets to market later.

But also, there is often a choice between spending code size, runtime speed, or data transferred. If we can write some code to ship cover image previews in 200 bytes versus blank until the extra full request finishes, we're gonna write that code. Similarly, if shipping another image decoder lets us shave a bit off every photo people download, we're gonna ship that decoder and the glue code to go with it. (See also SPDY and such meaning another network stack.) Code size is the least precious resource, way less important to conserve than network latency or data, programmer time, user-perceived performance, reliability, or developer productivity. Until you run out of it, of course...

Depends. That's only once you're already the only game in town. In the F2P world, we have empirical proof that download size and launch time are among the most important. As I can watch in near real time as we make changes and more or less people kill the app before even seeing what it is. Two years ago one of the best things we did for revenue was add background downloading and getting the initial install under 50megs for Google to single serve it or Apple to let it download on 3G.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Oh, certainly, it can affect adoption, and I remember many many hours spent agonizing about how to keep Firefox under 5MB so we would lose fewer people to mid-download distraction. We do care about download size for the FB app (the cell-network threshold as one example), and even more so on Android, but in our context code size is often better to spend than most other things, which is how apps get big.

VikingofRock
Aug 24, 2008




Jsor posted:

Hell, I just built Hello, World in rust with Release flags and it's 2.4MB, though that links the standard library. Even a C file with only an empty main function is 124KB after compiling it.

The difference probably comes from static linking with Rust vs. dynamic linking with C. Another difference is that rustc embeds HP Lovecraft quotes in every executable, which hopefully will get changed soon because that is pretty cringeworthy.

Linear Zoetrope
Nov 28, 2011

A hero must cook

VikingofRock posted:

The difference probably comes from static linking with Rust vs. dynamic linking with C. Another difference is that rustc embeds HP Lovecraft quotes in every executable, which hopefully will get changed soon because that is pretty cringeworthy.

Oh yeah, I know why Rust's are bigger, I wasn't comparing the two, I was just saying that executables in general are big, even 124KB is "quite a bit" if you want to compare it to ancient computers.

I didn't know about the Lovecraft thing, though...

E: Looks like the Lovecraft stuff was removed in January.

Linear Zoetrope fucked around with this message at 06:37 on Aug 16, 2015

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Pavlov posted:

APL got brought up a few pages ago. Apparently it's a convention to use greek letters as variables. I'd like to think that somewhere right now, a programming intern is hearing "No no, that's not a 'w' that an omega."

The greek letters are mostly builtin operators or special keywords. Unary Iota generates a range 1…N. Binary Rho is "reshape", for restructuring matrices and lists. Alpha and Omega typically indicate the first and last argument to a function, respectively, etc. You won't know them if you don't learn them, but if you're actually programming in APL you'll see and use these operators and symbols every day.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Jsor posted:

Oh yeah, I know why Rust's are bigger, I wasn't comparing the two, I was just saying that executables in general are big, even 124KB is "quite a bit" if you want to compare it to ancient computers.

I didn't know about the Lovecraft thing, though...

E: Looks like the Lovecraft stuff was removed in January.

I mean part of it is you're basically shipping a runtime/std library. I know Swift adds a minimum of around ~2mb on not-newest OSes that don't ship the base of the language with the OS.

Subjunctive posted:

Oh, certainly, it can affect adoption, and I remember many many hours spent agonizing about how to keep Firefox under 5MB so we would lose fewer people to mid-download distraction. We do care about download size for the FB app (the cell-network threshold as one example), and even more so on Android, but in our context code size is often better to spend than most other things, which is how apps get big.

You're also talking about binary size, which is something that hits users every two weeks at most (for ideal FB release adoption). On iOS, where the numbers don't drop hard until after you can't install over cellular (100mb), there's a case for making the binary bigger if you can add code that makes every cold start/interaction faster.

ultramiraculous fucked around with this message at 12:11 on Aug 16, 2015

VikingofRock
Aug 24, 2008




Jsor posted:

E: Looks like the Lovecraft stuff was removed in January.

Ah, looks like you are right. My bad!

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

comedyblissoption posted:

is it a requirement to only use terse 1-2 character identifiers in APL or is it just an insufferable programming style

It's the latter, although the "style guide" for K explicitly recommends it.

This is how the creator of K likes to write C code. Definitely a thing for this thread. :stonk:

e: you know, it's so TERSE® and EFFICIENT® that I can just quote it:

code:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<sys/mman.h>
typedef void V;typedef int I;typedef double F;typedef unsigned char C,*S;typedef long L;
#define O           printf
#define R           return
#define I(a...)     if(a)
#define W(a...)     while(a)

#define A(a...)     {if(!(a))R 0;}
#define Q(x,s)      {if(x)R O("ERROR: %s\n",s),(S)0;}

#define P(x,a...)   {if(x)R a;}
#define N(n,a...)   {I i=0,_i=(n);for(;i<_i;++i){a;}}
#define J(n,a...)   {I j=0,_j=(n);for(;j<_j;++j){a;}}
#define MIN(a,b)    ({typeof(a)_a=(a);typeof(a)_b=(b);_a<_b?_a:_b;})
#define MAX(a,b)    ({typeof(a)_a=(a);typeof(a)_b=(b);_a>_b?_a:_b;})
#define L8          (8==sizeof(L))
__inline S map(L*n,S s){I d=open(s,0);Q(0>d,s)L b[22];R fstat(d,&b),s=mmap(0,*n=b[L8+5],PROT_READ,MAP_PRIVATE,d,0),close(d),s;}

// reassemble(5-25hours 70-300lines)  READ(.5hour) k(1hour) c(1hour) 6lines

// overlap
I f(S s,S t){I a=strlen(s),b=strlen(t),m=0;P(strstr(s,t),b)N(MIN(a,b),I(!memcmp(s+a-i,t,i))m=i)R m;}

// merge
V g(I n,S*b){I m=0,mi=0,mj=1;N(n,J(n,I k=i!=j?f(b[i],b[j]):0;I(m<k)m=k,mi=i,mj=j))  // max(m mi mj)
 S s=b[mi],t=b[mj];b[mi]=strcat(strcpy(malloc(strlen(s)+strlen(t)+1-m),s),t+m),b[mj]=b[n-1],free(s),free(t);}

// run
I main(I n,S*x){L m;S b[20000],s=map(&m,x[1]);A(s)
 n=0;N(m-1,I h;I('{'==s[i])h=i+1;I('}'==s[i])b[n++]=strndup(s+h,i-h))
 W(1<n)g(n--,b);O("%s\n",*b),free(*b);}

NihilCredo fucked around with this message at 13:44 on Aug 16, 2015

KernelSlanders
May 27, 2013

Rogue operating systems on occasion spread lies and rumors about me.

comedyblissoption posted:

It will also raise questions on what does it mean when there's just a single space

code:
1 *2+ 3
1* 2 +3
Unless you enforce this to be a compiler error, whichever option you choose is horrible because you've now made all your code difficult to read since a single space or its omission changes the entire meaning of the expression.

You'll also have to consider what does it mean when you break an expression across a newline.

Yes, that should be a compiler error.

Pavlov
Oct 21, 2012

I've long been fascinated with how the alt-right develops elaborate and obscure dog whistles to try to communicate their meaning without having to say it out loud
Stepan Andreyevich Bandera being the most prominent example of that

NihilCredo posted:

It's the latter, although the "style guide" for K explicitly recommends it.

This is how the creator of K likes to write C code. Definitely a thing for this thread. :stonk:

e: you know, it's so TERSE® and EFFICIENT® that I can just quote it:

code:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<sys/mman.h>
typedef void V;typedef int I;typedef double F;typedef unsigned char C,*S;typedef long L;
#define O           printf
#define R           return
#define I(a...)     if(a)
#define W(a...)     while(a)

#define A(a...)     {if(!(a))R 0;}
#define Q(x,s)      {if(x)R O("ERROR: %s\n",s),(S)0;}

#define P(x,a...)   {if(x)R a;}
#define N(n,a...)   {I i=0,_i=(n);for(;i<_i;++i){a;}}
#define J(n,a...)   {I j=0,_j=(n);for(;j<_j;++j){a;}}
#define MIN(a,b)    ({typeof(a)_a=(a);typeof(a)_b=(b);_a<_b?_a:_b;})
#define MAX(a,b)    ({typeof(a)_a=(a);typeof(a)_b=(b);_a>_b?_a:_b;})
#define L8          (8==sizeof(L))
__inline S map(L*n,S s){I d=open(s,0);Q(0>d,s)L b[22];R fstat(d,&b),s=mmap(0,*n=b[L8+5],PROT_READ,MAP_PRIVATE,d,0),close(d),s;}

// reassemble(5-25hours 70-300lines)  READ(.5hour) k(1hour) c(1hour) 6lines

// overlap
I f(S s,S t){I a=strlen(s),b=strlen(t),m=0;P(strstr(s,t),b)N(MIN(a,b),I(!memcmp(s+a-i,t,i))m=i)R m;}

// merge
V g(I n,S*b){I m=0,mi=0,mj=1;N(n,J(n,I k=i!=j?f(b[i],b[j]):0;I(m<k)m=k,mi=i,mj=j))  // max(m mi mj)
 S s=b[mi],t=b[mj];b[mi]=strcat(strcpy(malloc(strlen(s)+strlen(t)+1-m),s),t+m),b[mj]=b[n-1],free(s),free(t);}

// run
I main(I n,S*x){L m;S b[20000],s=map(&m,x[1]);A(s)
 n=0;N(m-1,I h;I('{'==s[i])h=i+1;I('}'==s[i])b[n++]=strndup(s+h,i-h))
 W(1<n)g(n--,b);O("%s\n",*b),free(*b);}

This is a beast of terrifying beauty.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

NihilCredo posted:

It's the latter, although the "style guide" for K explicitly recommends it.

This is how the creator of K likes to write C code. Definitely a thing for this thread. :stonk:

e: you know, it's so TERSE® and EFFICIENT® that I can just quote it:

code:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<sys/mman.h>
typedef void V;typedef int I;typedef double F;typedef unsigned char C,*S;typedef long L;
#define O           printf
#define R           return
#define I(a...)     if(a)
#define W(a...)     while(a)

#define A(a...)     {if(!(a))R 0;}
#define Q(x,s)      {if(x)R O("ERROR: %s\n",s),(S)0;}

#define P(x,a...)   {if(x)R a;}
#define N(n,a...)   {I i=0,_i=(n);for(;i<_i;++i){a;}}
#define J(n,a...)   {I j=0,_j=(n);for(;j<_j;++j){a;}}
#define MIN(a,b)    ({typeof(a)_a=(a);typeof(a)_b=(b);_a<_b?_a:_b;})
#define MAX(a,b)    ({typeof(a)_a=(a);typeof(a)_b=(b);_a>_b?_a:_b;})
#define L8          (8==sizeof(L))
__inline S map(L*n,S s){I d=open(s,0);Q(0>d,s)L b[22];R fstat(d,&b),s=mmap(0,*n=b[L8+5],PROT_READ,MAP_PRIVATE,d,0),close(d),s;}

// reassemble(5-25hours 70-300lines)  READ(.5hour) k(1hour) c(1hour) 6lines

// overlap
I f(S s,S t){I a=strlen(s),b=strlen(t),m=0;P(strstr(s,t),b)N(MIN(a,b),I(!memcmp(s+a-i,t,i))m=i)R m;}

// merge
V g(I n,S*b){I m=0,mi=0,mj=1;N(n,J(n,I k=i!=j?f(b[i],b[j]):0;I(m<k)m=k,mi=i,mj=j))  // max(m mi mj)
 S s=b[mi],t=b[mj];b[mi]=strcat(strcpy(malloc(strlen(s)+strlen(t)+1-m),s),t+m),b[mj]=b[n-1],free(s),free(t);}

// run
I main(I n,S*x){L m;S b[20000],s=map(&m,x[1]);A(s)
 n=0;N(m-1,I h;I('{'==s[i])h=i+1;I('}'==s[i])b[n++]=strndup(s+h,i-h))
 W(1<n)g(n--,b);O("%s\n",*b),free(*b);}

I see some PROT_READ in there, but it's being eaten by some... APL.. or something

comedyblissoption
Mar 15, 2006

even the filename is tersely labelled as "a.c"

Linear Zoetrope
Nov 28, 2011

A hero must cook

comedyblissoption posted:

even the filename is tersely labelled as "a.c"

Well, what else am I going to compile into a.out, smart guy?

comedyblissoption
Mar 15, 2006

I will comment though that I find the code actually more readable w/ 1-2 letter variable names when the context is small and the context is obvious like in the common haskell coding style.

Soricidus
Oct 21, 2010
freedom-hating statist shill

comedyblissoption posted:

I will comment though that I find the code actually more readable w/ 1-2 letter variable names when the context is small and the context is obvious like in the common haskell coding style.

didn't we just do this? or was that in the terrible programmer thread, I always get these two mixed up

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Soricidus posted:

didn't we just do this? or was that in the terrible programmer thread, I always get these two mixed up

we just did this

Linear Zoetrope
Nov 28, 2011

A hero must cook
Yes, we agreed that APL is art.

KaneTW
Dec 2, 2011

comedyblissoption posted:

I will comment though that I find the code actually more readable w/ 1-2 letter variable names when the context is small and the context is obvious like in the common haskell coding style.
Yup. Stuff like
code:
map f (x:xs) = f x : map f xs
map _ [] = []
is nice and good.

But that APL code should be destroyed and the creator shot.

Deus Rex
Mar 5, 2005

Jsor posted:

Hell, I just built Hello, World in rust with Release flags and it's 2.4MB, though that links the standard library. Even a C file with only an empty main function is 124KB after compiling it.

Build the Rust with -O -C lto and the C with (assuming gcc) -O2 -flto -static and I think you'll find there's not much difference, or even that the Rust executable is smaller. (of course the Rust executable isn't statically linking libc, but with LTO and no dependency on a lot of the libc stuff like malloc it probably works out to about the same)

ExcessBLarg!
Sep 1, 2001

VikingofRock posted:

What if you are a Japanese company, writing an API aimed at Japanese programmers?
Ruby is a language originally designed by a Japanese and is still principally developed by a Japanese community. The first eight or so years the language was around it was virtually unheard of among English-speaking programmers, in part, due to the lack of English-language documentation.

But the language itself is comprised of English keywords, often in place of language-neutral symbols, as are all classes and method names. It also assumes that capitalized identifiers are constants. Neither of these things were done to promote accessibility of the language outside the Japanese community. It was just the natural way to build a programming language for someone well versed in a number of existing languages.

Ruby did make some interesting multiligualization decisions though. It eschewed multibyte Unicode (specifically UCS-2 and UTF-16) as a default "internal" encoding in favor of equal support for ASCII, EUC-JP, Shift JIS, and UTF-8 at the runtime level. Since Ruby 1.9, each String object instance has an associated encoding, with methods to safely translate between encodings. Only recent did UTF-8 become the default source encoding.

ExcessBLarg! fucked around with this message at 22:04 on Aug 16, 2015

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

Suspicious Dish posted:

Is there something special about Java classes that makes them so heavy-weight in terms of code size?
Because they're full of Enterprise.

Bongo Bill
Jan 17, 2012

It's always a good time to remember FizzBuzzEnterpriseEdition.

Dylan16807
May 12, 2010

ExcessBLarg! posted:

Ruby did make some interesting multiligualization decisions though. It eschewed multibyte Unicode (specifically UCS-2 and UTF-16) as a default "internal" encoding in favor of equal support for ASCII, EUC-JP, Shift JIS, and UTF-8 at the runtime level. Since Ruby 1.9, each String object instance has an associated encoding, with methods to safely translate between encodings. Only recent did UTF-8 become the default source encoding.

To be fair you never want to use UTF-16.

Soricidus
Oct 21, 2010
freedom-hating statist shill

Dylan16807 posted:

To be fair you never want to use UTF-16.

It used to be fine but then they went and put 💩 outside the bmp and suddenly surrogate pairs stopped being purely hypothetical

ExcessBLarg!
Sep 1, 2001

Dylan16807 posted:

To be fair you never want to use UTF-16.
Well yeah, even if one pretends the surrogate pair mess never happened, an encoding not (largely) backwards compatible with ASCII is going to be a mess, especially in any mixed-encoding context. UTF-8, being another Thompson hack of genius is the way everyone should've done it from the get-go. The Japanese, though, have (or at least, had) valid complaints against Unicode itself, hence Ruby's largely encoding-agnostic position.

Athas
Aug 6, 2007

fuck that joker

Pavlov posted:

APL got brought up a few pages ago. Apparently it's a convention to use greek letters as variables. I'd like to think that somewhere right now, a programming intern is hearing "No no, that's not a 'w' that an omega."

Actually, in APL, it is not valid to use Greek letters for variable or function names. It is valid for function parameter names, kind of, because the two parameters permitted for a function are always called ⍺ and ⍵. This means that APL can look kind of funny because everything that uses built-in operations is written very succintly using symbols, but user-defined functions and variables often have user-readable names. Here's an example written by a colleague of mine:

https://raw.githubusercontent.com/dybber/aplbench/master/benchmarks/rodinia-hotspot/tail/hotspot.apl

The weird a-like symbol denotes a line comment if you are curious. The curly braces denote lambdas, kind of.

TheresaJayne
Jul 1, 2011

Suspicious Dish posted:

Is there something special about Java classes that makes them so heavy-weight in terms of code size?

what do you mean heavyweight?

I did a POC for work, and it had 10 classes each of 1k each = fully working program in 10k java is tiny when compared to VB/ C#

I once did a desktop App in VB.net that when compiled was 8MB with 8MB runtime download increase.

We then redid the whole app in VB6 at my pushing, and compiled it was 4mb and 4mb runtime, so just reverting to a previous vb version halved the size.

its the MFC that make it large. the default libraries there should be tools available to allow removal of unused code once the compilation is complete then you would find a lot of larger programs are now a lot smaller.

Adbot
ADBOT LOVES YOU

kitten smoothie
Dec 29, 2001

Oh, nice, an Android library to help you figure out your user's phone from their model number ("Moto X," not "XT1049.").

Oh, wait.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply