|
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!
|
# ? Sep 23, 2013 20:25 |
|
|
# ? May 20, 2024 03:08 |
|
|
# ? Sep 23, 2013 20:29 |
|
Notorious b.s.d. posted:tbh i don't even like operators that much for numbers. this is an angle where lisp syntax rules imo
|
# ? Sep 23, 2013 20:33 |
|
Shaggar posted:"oh but for this one highly special needs math thing it actually makes sense!" 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
|
# ? Sep 23, 2013 20:38 |
|
"ABCDEF" - "EF" = "ABCD"
|
# ? Sep 23, 2013 20:55 |
as usual, i used ruby today. it was ok i guess.
|
|
# ? Sep 23, 2013 20:56 |
|
ruby owns and doesn't make you instantiate and object just to used numbers
|
# ? Sep 23, 2013 20:57 |
|
Symbolic Butt posted:this is an angle where lisp syntax rules imo lisp syntax unironically owns
|
# ? Sep 23, 2013 21:06 |
|
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 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.
|
# ? Sep 23, 2013 21:07 |
|
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:
|
# ? Sep 23, 2013 21:09 |
|
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 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
|
# ? Sep 23, 2013 21:14 |
|
Notorious b.s.d. posted:you could not be more wrong if you tried i know
|
# ? Sep 23, 2013 21:14 |
|
code:
|
# ? Sep 23, 2013 21:24 |
|
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 |
# ? Sep 23, 2013 21:29 |
|
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" 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
|
# ? Sep 23, 2013 21:38 |
|
Notorious b.s.d. posted:lisp syntax unironically owns
|
# ? Sep 23, 2013 21:52 |
|
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" 'why isn't Java C?'
|
# ? Sep 23, 2013 22:00 |
|
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 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?
|
# ? Sep 23, 2013 22:02 |
|
PleasingFungus posted:'why isn't Java C?' im the false dichotomy
|
# ? Sep 23, 2013 22:02 |
|
Zlodo posted:im the false dichotomy I hear ya about value types. It blows rear end that Java won't let you make structs.
|
# ? Sep 23, 2013 22:07 |
|
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. quote:Overloading operators for math is real dumb. some people happen to have to work a lot with other datatypes than just int bool and string
|
# ? Sep 23, 2013 22:14 |
|
do you even profile?
|
# ? Sep 23, 2013 22:42 |
|
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 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.
|
# ? Sep 23, 2013 22:49 |
|
use the least terrible thing that is fast enough until one of those things changes
|
# ? Sep 23, 2013 22:51 |
|
Mr SuperAwesome posted:what, as in "i don't like typing System.Collections.Generic.List<KeyValuePair<Butt, Fart>>;" 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:
obviously i want a System.Timers.Timer or i wouldnt have used the namespace but the compiler will barf on it so code:
disambiguation is most of how it gets used but again, generics can get kind of verbose. i mean do you really want a code:
code:
|
# ? Sep 23, 2013 23:04 |
|
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)
|
# ? Sep 23, 2013 23:06 |
|
"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"
|
# ? Sep 23, 2013 23:08 |
|
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. 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 |
# ? Sep 23, 2013 23:09 |
|
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.
|
# ? Sep 23, 2013 23:11 |
|
oh i found some code i wrote that uses itcode:
now maybe you like seeing three layers of generics in your method signatures but me, i'll shorten them down
|
# ? Sep 23, 2013 23:15 |
|
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
|
# ? Sep 23, 2013 23:18 |
|
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. 2 billion dollars. overage charges in the contract for each new feature.
|
# ? Sep 23, 2013 23:19 |
|
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
|
# ? Sep 23, 2013 23:19 |
|
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"
|
# ? Sep 23, 2013 23:27 |
|
okay it's not actually on android but lets not go there
|
# ? Sep 23, 2013 23:28 |
|
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 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.
|
# ? Sep 23, 2013 23:41 |
|
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.
|
# ? Sep 24, 2013 00:21 |
|
this really is the terrible programmer hideout
|
# ? Sep 24, 2013 03:59 |
|
yes you are safe here
|
# ? Sep 24, 2013 04:01 |
|
|
# ? May 20, 2024 03:08 |
|
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:
using the term to refer to anything else is just confusing
|
# ? Sep 24, 2013 06:39 |