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.
 
  • Locked thread
Workaday Wizard
Oct 23, 2009

by Pragmatica

USSMICHELLEBACHMAN posted:

everyone who programs has special needs though

lol

the joke is good. worrks on so many levels

you made my day good sir!

Adbot
ADBOT LOVES YOU

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
:tipshat:

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Notorious b.s.d. posted:

tbh i don't even like operators that much for numbers.

i would be perfectly happy with a language that had explicit method names even for math

this is an angle where lisp syntax rules imo

fritz
Jul 26, 2003

Shaggar posted:

"oh but for this one highly special needs math thing it actually makes sense!"
well too bad. we aren't breaking the language to suit your stupid autism.

i was reading an article last week and they were all talkign up c++ because they could use templates to get their algorithm to work on any of the semirings they needed w/o having to do any extra work

qntm
Jun 17, 2009
"ABCDEF" - "EF" = "ABCD"

double sulk
Jul 2, 2010

as usual, i used ruby today. it was ok i guess.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
ruby owns and doesn't make you instantiate and object just to used numbers

Notorious b.s.d.
Jan 25, 2003

by Reene

Symbolic Butt posted:

this is an angle where lisp syntax rules imo

lisp syntax unironically owns

Notorious b.s.d.
Jan 25, 2003

by Reene

Zlodo posted:

idc my point is that it is actually always passed by reference from a low level point of view (as opposed as being directly pushed onto the stack or even across multiple registers like when objects are passed by value in c++) which in turns makes every class no matter how small such as a mathematical vector inefficient as hell even though there should be no reason objects cant be lightweight and still have methods or overloaded operators


so it precludes a lot of cool things because theres this language limitation where every object is heavyweight as it has to be allocated on its own on the heap

c# is the only high-level language I can think of that makes stack-allocated objects a choice, and even then they are tightly limited

what did you have in mind where stack allocation is the norm?

edit: there is also c++, but lol c++ as high level. high levels of bullshit.

Notorious b.s.d.
Jan 25, 2003

by Reene

USSMICHELLEBACHMAN posted:

ruby owns and doesn't make you instantiate and object just to used numbers

you could not be more wrong if you tried

Ruby code:
irb(main):001:0> 1.class
=> Fixnum
irb(main):002:0> 1.is_a? Object
=> true

Zlodo
Nov 25, 2006

Notorious b.s.d. posted:

c# is the only high-level language I can think of that makes stack-allocated objects a choice, and even then they are tightly limited

what did you have in mind where stack allocation is the norm?

vectors, matrices, tuples, smart pointers, option type wrappers, tagged unions... there's lots of useful small things that are nice to be able to be passed around efficiently or embedded into other objects without being separated somewhere in memory for cache and memory allocation efficiency

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Notorious b.s.d. posted:

you could not be more wrong if you tried

Ruby code:
irb(main):001:0> 1.class
=> Fixnum
irb(main):002:0> 1.is_a? Object
=> true

i know

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
code:
irb(main):001:0> 1/2+3
=> 3
irb(main):002:0> 1./2.+3
=> 0
:3:

Notorious b.s.d.
Jan 25, 2003

by Reene

Zlodo posted:

vectors, matrices, tuples, smart pointers, option type wrappers, tagged unions... there's lots of useful small things that are nice to be able to be passed around efficiently or embedded into other objects without being separated somewhere in memory for cache and memory allocation efficiency

saying "gee i'd like to have this in cache" is not the same as "gee i'd like to worry about stack allocation details in my high level language"

i don't really worry about any of that stuff on a jvm language. maybe that's why this is the terrible programmer safe zone / hideout

i have about a billion fuckin problems before i worry about whether the object wrappers around my vectors have enough memory locality to make effective use of cache lines

Notorious b.s.d. fucked around with this message at 21:32 on Sep 23, 2013

Zlodo
Nov 25, 2006

Notorious b.s.d. posted:

saying "gee i'd like to have this in cache" is not the same as "gee i'd like to worry about stack allocation details in my high level language"

i don't really worry about any of that stuff on a jvm language.

its not "worrying about stack allocation details", its being able to say "pass this thing by value because i know its small" and even if at high level you dont necessarily have to care being able to pass value types around efficiently is the difference between "wee lets use option types everywhere bc its neat and almost free" and "better be careful not to overuse those because theyre pointlessly slow"

also yeah i can tell java and c# developers dont give a gently caress about performances whenever things lock up on me to crap the bed while doing garbage collection
you can tell more and more of visual studio is replaced with slow c# code with each version bc that thing is becoming comically slow

and in fact i'm not saying "you sholuld worry about cache locality" but perhaps the people who design the language / vm / libraries that you use should

weird
Jun 4, 2012

by zen death robot

Notorious b.s.d. posted:

lisp syntax unironically owns

PleasingFungus
Oct 10, 2012
idiot asshole bitch who should fuck off

Zlodo posted:

its not "worrying about stack allocation details", its being able to say "pass this thing by value because i know its small" and even if at high level you dont necessarily have to care being able to pass value types around efficiently is the difference between "wee lets use option types everywhere bc its neat and almost free" and "better be careful not to overuse those because theyre pointlessly slow"

also yeah i can tell java and c# developers dont give a gently caress about performances whenever things lock up on me to crap the bed while doing garbage collection
you can tell more and more of visual studio is replaced with slow c# code with each version bc that thing is becoming comically slow

and in fact i'm not saying "you sholuld worry about cache locality" but perhaps the people who design the language / vm / libraries that you use should

'why isn't Java C?'

Nomnom Cookie
Aug 30, 2009



Zlodo posted:

idc my point is that it is actually always passed by reference from a low level point of view (as opposed as being directly pushed onto the stack or even across multiple registers like when objects are passed by value in c++) which in turns makes every class no matter how small such as a mathematical vector inefficient as hell even though there should be no reason objects cant be lightweight and still have methods or overloaded operators


so it precludes a lot of cool things because theres this language limitation where every object is heavyweight as it has to be allocated on its own on the heap

your opening quite the can of worms there mate hope that no functional programmer hear you

Java passes references by value. Pass by reference is a different thing that Java doesn't do. Ref params in C#, iirc pascal does it too.

Also Hotspot is p fuckin sharp about heap management, much moreso than C++. Maybe you lose some cache locality but the big killer is the inherent per-object overhead in Java which is something like 16 bytes.

Overloading operators for math is real dumb. Are we going to import the rest of math and program in latex?

Zlodo
Nov 25, 2006

PleasingFungus posted:

'why isn't Java C?'

im the false dichotomy

Nomnom Cookie
Aug 30, 2009



Zlodo posted:

im the false dichotomy

I hear ya about value types. It blows rear end that Java won't let you make structs.

Zlodo
Nov 25, 2006

Nomnom Cookie posted:

Java passes references by value. Pass by reference is a different thing that Java doesn't do. Ref params in C#, iirc pascal does it too.

i was talking of the implementation of parameter passing by the compiler, not about the semantics

quote:

Also Hotspot is p fuckin sharp about heap management, much moreso than C++. Maybe you lose some cache locality but the big killer is the inherent per-object overhead in Java which is something like 16 bytes.
there are other costs with heap allocations, such as the allocation itself which is order of magnitudes costlier than allocating something on the stack (which is just an addition)


quote:

Overloading operators for math is real dumb.
when your doing a lot of operations on things like vectors or matrices or whatever (or like say, doing things like interpolating colors) overloading operators is much more concise and readable

some people happen to have to work a lot with other datatypes than just int bool and string

Brain Candy
May 18, 2006


do you even profile?

Brain Candy
May 18, 2006

Zlodo posted:

when your doing a lot of operations on things like vectors or matrices or whatever (or like say, doing things like interpolating colors) overloading operators is much more concise and readable

some people happen to have to work a lot with other datatypes than just int bool and string

stack allocation, operator overloading and vectorization are a thing, but IDK, the winner for math isn't c++/c.

surprise, it's fortran and OpenCL/CUDA. most of the 'fast' c/c++ libraries are wrappers.

Brain Candy
May 18, 2006

use the least terrible thing that is fast enough until one of those things changes :shrug:

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

Mr SuperAwesome posted:

what, as in "i don't like typing System.Collections.Generic.List<KeyValuePair<Butt, Fart>>;"

- why wouldn't u just including System.Collections.Generics making it List<KeyValuePair<Butt,Fart>>;
- why wouldn't u use a dictionary
- why wouldn't you use var 99% of the time except for instantiating stuff

like the only way this seems to make sense is if you're doing TypeOf's all over the place or something. or if you have intellisense turned off for some reason
what about currencies (decimal)

lol if you can't think of a way you'd actually use this

like obviously a list of keyvaluepairs isn't useful but i didnt feel like coming up with a real example

i sort of assumed that the use would be obvious to anyone that wasn't an idiot but i guess i am in the terrible programmer thread so here are a couple of better ones

code:
using System.Threading;
using System.Timers;
ok so now if i want a Timer what namespace does it come from? there's System.Threading.Timer and System.Timers.Timer

obviously i want a System.Timers.Timer or i wouldnt have used the namespace but the compiler will barf on it so
code:
using Timer = System.Timers.Timer;
omg now i can just write Timer in my code and it goes to the right one instead of me having to use System.Timers.Timer timer; everywhere

disambiguation is most of how it gets used but again, generics can get kind of verbose. i mean do you really want a

code:
ConcurrentDictionary<Tuple<string, int>, IEnumerable<List<Butt>>> cd = new ImNotEvenTypingThisShit();
when you could just do
code:
using ButtCollection = ConcurrentDictionary<Tuple<string, int>, IEnumerable<Task<Butt>>>;
ButtCollection cd = new ButtCollection();
maybe you dont use generics enough in your own code for it to matter but with stuff like IEnumerable<> and Task<> floating around now your code is going to look messy as gently caress without these

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
and yes you could just use var in that exact example, i'll leave it to your imagination to work out where you might not be able to use var to shorten that thing (hint: perhaps you'd like to return it from a method, pass it to a method, or keep it in a field)

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
"why wouldn't you just create an entirely new class just to encapsulate that type instead of using a language feature that exists in every c-lang ever"

Zlodo
Nov 25, 2006

Brain Candy posted:

do you even profile?

profiling is useful when considering an optimization that comes at a cost of your program's readability/maintainability/flexibility/stability which is not what is being discussed here

"ok i'll do a new on that struct and pass a smart pointer to it and then i'll profile and if necessary replace it with passing it directly by value which is both much more readable and faster" - nobody ever


Brain Candy posted:

stack allocation, operator overloading and vectorization are a thing, but IDK, the winner for math isn't c++/c.

surprise, it's fortran and OpenCL/CUDA. most of the 'fast' c/c++ libraries are wrappers.
what does raw number crunching performance have to do with operator overloading?

and yes when it comes to raw number crunching doing things on the gpu is much faste but there are situations where you dont need that much number crunching throughput but prefer to keep the data on the cpu side because you're doing a bunch of different things with them that cant be parallelized very well and also you may not be able to afford the latency of downloading the results back from the graphic card. its almost as if there was no single best tool for every task (there are lots that are bad at everything though)

Zlodo fucked around with this message at 23:11 on Sep 23, 2013

EAT THE EGGS RICOLA
May 29, 2008

Uh someone just asked me unironically to give them a quote for how much it would cost to develop a Canadian equivalent to the U.S. Library of Congress's semantic web/linked data service.

How do you even reply to that.

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
oh i found some code i wrote that uses it

code:
using MessageHandler = System.EventHandler<EventArgs<ITransportMessage>>;
i removed the fully qualified namespaces for sanitization reasons but trust me they're long.

now maybe you like seeing three layers of generics in your method signatures but me, i'll shorten them down

Brain Candy
May 18, 2006

Zlodo posted:

profiling is useful when considering an optimization that comes at a cost of your program's readability/maintainability/flexibility/stability which is not what is being discussed here

this is exactly what you were discussing

quote:

its almost as if there was no single best tool for every task (there are lots that are bad at everything though)

i'm not the grandpa yelling java-is-slow

Brain Candy
May 18, 2006

EAT THE EGGS RICOLA posted:

Uh someone just asked me unironically to give them a quote for how much it would cost to develop a Canadian equivalent to the U.S. Library of Congress's semantic web/linked data service.

How do you even reply to that.

2 billion dollars. overage charges in the contract for each new feature.

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
oh also for some reason this code uses a different EventArgs than the one in .net (the code was written before generic versions of EventArgs were in the framework) so again you have to use some kind of type alias just to avoid having to qualify your name

basically, it's painfully obvious you've never written any real code in c#, just toy projects that didn't have to interoperate with anything but the .net framework

welcome to the terrible programmer thread

Salynne
Oct 25, 2007

Nomnom Cookie posted:

Also Hotspot is p fuckin sharp about heap management, much moreso than C++. Maybe you lose some cache locality but the big killer is the inherent per-object overhead in Java which is something like 16 bytes.

came to post this in reply

"the jvm is smarter than you"

Salynne
Oct 25, 2007
okay it's not actually on android but lets not go there

PleasingFungus
Oct 10, 2012
idiot asshole bitch who should fuck off

Zlodo posted:

profiling is useful when considering an optimization that comes at a cost of your program's readability/maintainability/flexibility/stability which is not what is being discussed here

"ok i'll do a new on that struct and pass a smart pointer to it and then i'll profile and if necessary replace it with passing it directly by value which is both much more readable and faster" - nobody ever

except that, in java, allocating objects on the heap is both natural, easy to read, and correct. this is because Java is not C.

like any optimization, arguing that objects should be allocated on the stack is a decision that should be handled case-by-case and justified by profiling. it is not a default. because Java is not C.

Nomnom Cookie
Aug 30, 2009



Zlodo posted:

i was talking of the implementation of parameter passing by the compiler, not about the semantics

I dunno why you're using the term pass by reference then. It has a clear meaning and deals with language semantics, not calling conventions. Taking your meaning, which is "everything is a pointer", it's not an actual issue. Dereferencing pointers from L1 is basically free. The biggest problems encountered by actual people writing actual high-performance Java (like HFT platforms and poo poo) are object overhead and GC.

Zlodo posted:

there are other costs with heap allocations, such as the allocation itself which is order of magnitudes costlier than allocating something on the stack (which is just an addition)

Bro you need to learn more about JVM internals if you want to poo poo on them. For starters, Hotspot allocates out of a thread-local buffer (imaginatively acronym'ed as TLAB). In the vast majority of cases Java allocations are pointer bumps. There are very cool things Hotspot can do because it GCs and compacts the heap, TLABs among them.

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:
this really is the terrible programmer hideout

uG
Apr 23, 2003

by Ralp
yes you are safe here

Adbot
ADBOT LOVES YOU

JewKiller 3000
Nov 28, 2006

by Lowtax

Nomnom Cookie posted:

I dunno why you're using the term pass by reference then. It has a clear meaning and deals with language semantics, not calling conventions.

adding to this, pass by reference refers to a language feature that allows you to write:

code:
a = x
b = y
swap(a, b)
assert(a == y && b == x)
if you can't define the function swap so that the assert passes, your language does not have pass by reference

using the term to refer to anything else is just confusing

  • Locked thread