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
MononcQc
May 29, 2007

who are you all :argh:

Adbot
ADBOT LOVES YOU

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug
I'm not there :/

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
man i really wish there were a flag for gcc to make it do constant string interning. that's one thing java did right. the lack of it is making life miserable for me right now :/

more like dICK
Feb 15, 2010

This is inevitable.
lmao at this Chinese guy

MononcQc
May 29, 2007

he works for blackberry/RIM afaik

Notorious b.s.d.
Jan 25, 2003

by Reene

Otto Skorzeny posted:

man i really wish there were a flag for gcc to make it do constant string interning. that's one thing java did right. the lack of it is making life miserable for me right now :/

how would this be possible with C's compilation model?

(or does gcc fail to identify identical string literals even in the same compile unit?)

Max Facetime
Apr 18, 2009

Notorious b.s.d. posted:

how would this be possible with C's compilation model?

(or does gcc fail to identify identical string literals even in the same compile unit?)

you would need to have the memory for the .exe writable, then for each string literal keep an array of pointers to the binary that you need to patch with the interned value before execution, then have an interning function to get the interned pointer, also afterwards remove writable bit and set executable bit... something like that, details details

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Notorious b.s.d. posted:

how would this be possible with C's compilation model?

(or does gcc fail to identify identical string literals even in the same compile unit?)

i'm talking in the same compilation unit. when i look at the map file, i can tell it's not interning/deduping when i do something like this

code:
static const char *foo[] = {
	"I",
	"Like",
	"Big",
	"Butts",
};

static const char *bar[] = {
	"I",
	"Like",
	"Big",
	"Butts",
};
obviously i can dedup these myself by making one table of strings and having foo and bar both point to it, but it's a pain in the rear end when i have a zillion of them (i'm finishing the menu tree for an industrial device, which is why i have a lot of tables of strings with partially or entirely the same contents) and exactly the sort of thing that a computer ought to do for me

Max Facetime
Apr 18, 2009

MononcQc posted:

this way lies INTERCAL

PleasingFungus posted:

I assumed that was the joke

it was really a reference to how in HTTP you can do everything with just GET, to the extent that the imperative word "get" becomes a formality or a matter of convention, or politeness like with the word "please"

I have no idea what INTERCAL is like

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Max Facetime posted:

I have no idea what INTERCAL is like

it's a programming language designed by eric raymond. that tells you pretty much all you need to know

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
my pregnant wife just called and said she hit a deer on the highway on the way to her parents house for the weekend while im stuck at work. gently caress this gay earth

suffix
Jul 27, 2013

Wheeee!

Otto Skorzeny posted:

i'm talking in the same compilation unit. when i look at the map file, i can tell it's not interning/deduping when i do something like this

code:
static const char *foo[] = {
	"I",
	"Like",
	"Big",
	"Butts",
};

static const char *bar[] = {
	"I",
	"Like",
	"Big",
	"Butts",
};
obviously i can dedup these myself by making one table of strings and having foo and bar both point to it, but it's a pain in the rear end when i have a zillion of them (i'm finishing the menu tree for an industrial device, which is why i have a lot of tables of strings with partially or entirely the same contents) and exactly the sort of thing that a computer ought to do for me

wfm, executable contains only one "Butts" even with -O0

obviously foo and bar aren't the same, since declared variables must have their own address.

MononcQc
May 29, 2007

Max Facetime posted:

it was really a reference to how in HTTP you can do everything with just GET, to the extent that the imperative word "get" becomes a formality or a matter of convention, or politeness like with the word "please"

I have no idea what INTERCAL is like

Here's what it's like:

quote:

INTERCAL has many other features designed to make it even more aesthetically unpleasing to the programmer: it uses statements such as "READ OUT", "IGNORE", "FORGET", and modifiers such as "PLEASE". This last keyword provides two reasons for the program's rejection by the compiler: if "PLEASE" does not appear often enough, the program is considered insufficiently polite, and the error message says this; if too often, the program could be rejected as excessively polite. Although this feature existed in the original INTERCAL compiler, it was undocumented.

[...]

C-INTERCAL also provides the COME FROM instruction, written DO COME FROM (line); CLC-INTERCAL and the most recent C-INTERCAL versions also provide computed COME FROM (DO COME FROM expression) and NEXT FROM, which is like COME FROM but also saves a return address on the NEXT STACK


Otto Skorzeny posted:

it's a programming language designed by eric raymond. that tells you pretty much all you need to know

Actually Don Woods and James M. Lyon

Posting Principle
Dec 10, 2011

by Ralp
thai bhat bitcoin shirt spotted

FamDav
Mar 29, 2008

suffix posted:

wfm, executable contains only one "Butts" even with -O0

obviously foo and bar aren't the same, since declared variables must have their own address.

i have to assume he's using some bespoke embedded compiler because they are notoriously bad.

if your compiler isnt putting them const char arrays in its own little memory hugbox, write a preprocessor that searches for something like @"this is my string" and converts it to a macro and prepend the data at the top of the file.

also tell your wife to hide in its abdomen for warmth

MononcQc
May 29, 2007

Posting Principle posted:

thai bhat bitcoin shirt spotted

Yurii Rashkovskii. He actually owns bex.io

FamDav
Mar 29, 2008

MononcQc posted:

Yurii Rashkovskii. He actually owns bex.io

cant you get your own thread in which to dock dicks

Posting Principle
Dec 10, 2011

by Ralp
bitcoin exchange as a service

loving kill me now

MononcQc
May 29, 2007

that was my reaction the first time around too

Zlodo
Nov 25, 2006

Notorious b.s.d. posted:

how would this be possible with C's compilation model?

link time optimization

Nomnom Cookie
Aug 30, 2009



Zlodo posted:

link time optimization

link time code gen maybe otherwise not enough information would be retained in the .o

Nomnom Cookie
Aug 30, 2009



also gcc's LTCG is terribad. i went to the effort of packaging an entirely separate toolchain on centos 6 to be able to use ltcg...and it couldn't build openmpi with ltcg turned on :qq:

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Nomnom Cookie posted:

also gcc's LTCG is terribad. i went to the effort of packaging an entirely separate toolchain on centos 6 to be able to use ltcg...and it couldn't build openmpi with ltcg turned on :qq:

this is what c-language programmers actually believe

Base Emitter
Apr 1, 2012

?

Symbolic Butt posted:

I'd say he's pretty hosed

it's probably a large program because it's being referred to as a project. it's legacy so that probably means nobody dared or was able to successfully port it before. and it's probably full of the most baffling control flow poo poo using goto. and lovely comments.

I actually kinda like f90, it's tricky at times but it feels much more straightforward to use than c. f77 is a nightmare. I had to debug some special PCA code in f77 and it was the most painful thing I done in my cj life, I wish I had taken a photo of all the diagrams I had to draw to figure the control flow.

that, and no physics professor will ever trust the port anyway because they're superstitious about numerical programming and that its absolutely vital to have run to run consistency over multiple decades. the reason the poor bastard has f77 source to begin with is (for example) somebody at cern wrote that strong interaction monte carlo in 1982 and so many papers have been published using that library that if you wrote a paper with a different implementation it would probably be rejected out of hand

they will of course never notice that you recompiled the same f77 on completely different platforms with different compilers and incompatible floating point hardware :science:

distortion park
Apr 25, 2011


Base Emitter posted:

they will of course never notice that you recompiled the same f77 on completely different platforms with different compilers and incompatible floating point hardware :science:

These sort of large physics programs also routinely require user modification to get them to work in new use cases, so similarity between different groups software is often fairly limited.

Zlodo
Nov 25, 2006

Nomnom Cookie posted:

link time code gen maybe otherwise not enough information would be retained in the .o

ltcg is a type of lto. a compiler could very well use normal .o w/ extra data to do lto

but yeah ltcg is the best king of lto. also use clang not gcc

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

Nomnom Cookie posted:

link time code gen maybe otherwise not enough information would be retained in the .o

COMDAT optimization is enough actually. This is how Visual C++ does it: allocate a COMDAT for each string, and give it a symbol name that's a mangling of the string contents. at link time, identical strings = identical COMDATs with identical names, so only one instance is kept

Nomnom Cookie
Aug 30, 2009



idk poo poo about the VS toolchain


Zlodo posted:

ltcg is a type of lto. a compiler could very well use normal .o w/ extra data to do lto

but yeah ltcg is the best king of lto. also use clang not gcc

it could but i have a very hard time believing that a *nix compiler would, because it would break compatibility with a 20 year old linker or elfutils or some poo poo. and i was working on clang but then quit that jerb. worked there 2 years but all i miss are those spec files. my artisanal gcc rpms

Socracheese
Oct 20, 2008

Base Emitter posted:

they will of course never notice that you recompiled the same f77 on completely different platforms with different compilers and incompatible floating point hardware :science:

pointsofdata posted:

These sort of large physics programs also routinely require user modification to get them to work in new use cases, so similarity between different groups software is often fairly limited.


are u tellin me nobody made their own science_float type? it would be really easy then you could define how many bits it is and how the floating point works - ohhh physicists they are psychotic, nvm

Socracheese
Oct 20, 2008

when i was like 13 i coded up a type in C++ for numbers with several hundred digits. I thought i was gonna crack some greatest prime factors and make a bunch of money. I found a thing online where they had huge numbers, and if you could tell them the greatest prime factors they'd give you like $30,000. I wrote a p cool algorithm that would exclude some results logically and thought I was hot poo poo. I fed in the number from the contest and pressed enter and it sat there for a while so I did some napkin math and figured out it would take somewhere between 300 and 5000 years for it to complete

Notorious b.s.d.
Jan 25, 2003

by Reene

Socracheese posted:

when i was like 13 i coded up a type in C++ for numbers with several hundred digits. I thought i was gonna crack some greatest prime factors and make a bunch of money. I found a thing online where they had huge numbers, and if you could tell them the greatest prime factors they'd give you like $30,000. I wrote a p cool algorithm that would exclude some results logically and thought I was hot poo poo. I fed in the number from the contest and pressed enter and it sat there for a while so I did some napkin math and figured out it would take somewhere between 300 and 5000 years for it to complete

so on your current pc it would take, what, six seconds?

Notorious b.s.d.
Jan 25, 2003

by Reene

Socracheese posted:

are u tellin me nobody made their own science_float type? it would be really easy then you could define how many bits it is and how the floating point works - ohhh physicists they are psychotic, nvm

for all operations, the "science_float" type calls out to a REST API to hire a postdoc to do the math on a hp48g and return results at the of a term

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison

Notorious b.s.d. posted:

for all operations, the "science_float" type calls out to a REST API to hire a postdoc to do the math on a hp48g and return results at the of a term

heh

Socracheese
Oct 20, 2008

Notorious b.s.d. posted:

so on your current pc it would take, what, six seconds?

yeah im sure u could use a cloud gpu cluster or something these days so i doubt anyone offers prizes like that anymore :( or the number is like 2048 digits long now

fritz
Jul 26, 2003

Socracheese posted:

are u tellin me nobody made their own science_float type? it would be really easy then you could define how many bits it is and how the floating point works - ohhh physicists they are psychotic, nvm
i saw this the other day
http://www.cs.berkeley.edu/~wkahan/ieee754status/754story.html

Nomnom Cookie
Aug 30, 2009



Socracheese posted:

are u tellin me nobody made their own science_float type? it would be really easy then you could define how many bits it is and how the floating point works - ohhh physicists they are psychotic, nvm

sure you could do that. now you're using soft floats instead of hard floats and your program is 10000x slower. have fun!

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

Socracheese posted:

then you could define ... how the floating point works

don't even loving joke

suffix
Jul 27, 2013

Wheeee!

Socracheese posted:

when i was like 13 i coded up a type in C++ for numbers with several hundred digits. I thought i was gonna crack some greatest prime factors and make a bunch of money. I found a thing online where they had huge numbers, and if you could tell them the greatest prime factors they'd give you like $30,000. I wrote a p cool algorithm that would exclude some results logically and thought I was hot poo poo. I fed in the number from the contest and pressed enter and it sat there for a while so I did some napkin math and figured out it would take somewhere between 300 and 5000 years for it to complete

same, except a file compressor that tries every possible program and picks the shortest one that matches the file

ah, to be young and innocent and know nothing about runtime complexity

Nomnom Cookie
Aug 30, 2009



some people, when confronted with an underflow, think "i know, i'll make my own floating point". now they have 5.6 x 1057 problems

Adbot
ADBOT LOVES YOU

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

Nomnom Cookie posted:

some people, when confronted with an underflow, think "i know, i'll make my own floating point". now they have 5.6 x 1057 problems

when i quote this elsewhere, should i cite it as [Cookie 2013] or what

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