/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?
Old thread:

Other urls found in this thread:

youtu.be/1bAixLaOCSA?t=269
en.wikipedia.org/wiki/Small_matter_of_programming
youtube.com/watch?v=str_mex__0M
people.cs.umass.edu/~emery/pubs/gcvsmalloc.pdf
twitter.com/NSFWRedditGif

frast

Scala best non-shitlang

Threadly reminder that if your language of choice isn't in the top 20 you're a tryhard poser and smug hipster and not a real programmer.

I want all prolog niggers to leave this programming forum immediately.

>D is x1.5 less popular than Perl6
How is it even possible for a language to be less popular than Perl6?

I tried Scala years ago and run into issues. (Slow af). Does it got better today?

scalaposter here
ehhh
sbt still takes 12sec to start on my shitbox
jvm + a fuckin thousand classes to read for fuckin hello world means startup time a shit
compile time is still the most common complaint (but so it is for Rust)

OTOH
- in true Java style, once it warms up, speed aint shabby at all (~2x slower on various toy problems during AoC compared to decent C++ solutions)
- they've been getting faster with the later releases
- Dotty (scala-next) is already faster without optimizations
- scala native start time is awesome (but it's no full JVM flavor)

in short, got better, still very worthy of criticism in some areas
give it a shot when you've got a project that fits its strengths (cuz non-laggy CLI tools are a non-starter unless scala-native does the job for you)

top 10*, you mean

>top dozen
ftfy

How do I make javax.swing look more aesthetically pleasing? These buttons are atrocious.

look'n'feel

javatards:
>sane defaults dont real

I get confused whenever I hear Americans talk about how there are CS graduates who can’t even print a "Hello world". Are your CS classes purely theoric? Don’t you program at all?

Two bee hornet, top 1 is all you need.

Use SWT

write your own windowing toolkit on top of DirectX

>CS
>writing actual programs
theory's the important stuff, implementation's "left as an exercise for the reader"
see also
>PhD style code

is there even a thing James Gosling did right in his entire computing career

Who writes desktop apps in Java nowadays anyway?
Hell, does anyone write desktop apps anymore at all?

You think you can either write programs or learn theory? Jesus.

threadly reminder that russian code con eye candy > us "women in tech"
youtu.be/1bAixLaOCSA?t=269

Yes, he left Oracle in 2010.

Please kill me, it hurts to "live".

once you've figured out the theoretical algorithm, implementation is a en.wikipedia.org/wiki/Small_matter_of_programming

>MongoDB

stick to javascript, kid

>C
too much brainlets in this world

>posting fat slav java babushkas
>not posting qt Lisa who uses Emacs to code games in Rust
Shame on you: youtube.com/watch?v=str_mex__0M

>russian
>minsk

>"If it's not MongoDB, it's the WrongoDB."
>data loss enhancing installation defaults

Belorussians are not even in denial about being Russians.

>>minsk
yeah, that was some kind of russian rodent iirc

>school is making us learn Squeak

Please someone explain

>uuuuh, um, uhhhh, well
>lisapassing
>passing
>Rust
sry m8 not gay i.e. into traps, not that there's anything wrong with that *snort*

You have to be at least 18yo to use this site.

>a thing James Gosling did right
dat skullet, obviously

they correctly assume the majority of your underage b& class is retarded, so they give you the "everybody should program babbys first language" scam
enjoy

that's a paygirl, user

By not being JavaScript

>The Squeak programming language is a dialect of Smalltalk. It is object-oriented, class-based, and reflective.
Brainlet please.

>D dead last
RIP in piece

How do you loop through a 2D vector in C++?
I don't think what I'm doing is working.

>russian code con eye candy
>eye candy
>booth babe
>paygirl
no argument there mate
then again
>women "in tech"
>glorified token diversity hire
>token hire
>instead of looks, hired for diversity
honestly I'd go with the booth babes, at least they don't pretend they're something they ain't

D or Nim?

>I'm an adult who uses adult programming languages
Sure, kiddo.

Squeak is an implementation of Smalltalk, holy shit how retarded are people in this thread?

PLEASE tell me what's better than mongodb

>I don't think what I'm doing is working.
what are you doing

C++, no contest

>A 2D vector
A vector = a dynamic array or a vector = a 2 element tuple?

Neither, learn crystal.

refer to

C++ can't even split strings lmao

Why would you waste your time on long dead or stillborn languages? If you care about performance enough to use a language that compiles to the native code, use Rust or C++17.

What is a ``native code``?

t. langlet without efficient tokenizer in stdlib

Object code executed directly on CPU, as opposed to bytecode which requires JITing.

>>C++ vector
>do you mean a C++ vector, or a math vector?
autism, autism never changes

Hmm, in that case it's not a very big deal. Both D and Nim can compile to ``native code`` as it seems.

Don't know abour Rust though. AFAIK LLVM IR is not ``native`` as per your definition.

Most people here never went past high school, let alone know programming, and what object oriented languages are, not sure what you expected.

D

>projecting

>Both D and Nim can compile to ``native code`` as it seems.
Sure, but they both have GC, which results in suboptimal performance and memory usage.
>LLVM IR is not ``native`` as per your definition.
Sure, but Rust compiler doesn't produce LLVM IR, it produces native code, LLVM IR is used as an intermediate stage, just like gcc uses GENERIC.

C isn't even dead and it's still a better dead language than either of those two

>n-no you

>GC
>suboptimal performance
>I unironically believe malloc/free is O(1)

>which results in suboptimal performance and memory usage.
Actually, no. GCs will do a far better job than you in non-trivial projects, and it's certainly going to consume less memory.

And what's so bad about GC again?

tripfags considered harmful

>non-deterministic memory cleanup means bad performance

is a homosexual

>calls smooth actual booth babe babushka
>posts stage-anxious nerdslob with frizzy hair, goggle glasses and frumpy bagshirt
the absolute state of [etc etc]

C isn't self hosted. Not a bad thing, just putting it out there.
Aren't we all? Sup Forums is pretty gay.

>and it's certainly going to consume less memory.
bullshit, the only way a GC can exceed manually managed memory in throughput is if it has a shitton of RAM to expend so collection cycles are infrequent

>batch processing advantages dont real

Yes, and it works better than those """"modern web solutions"""" of today.

tripfags are double-gay

How are you doing it rn? Shouldn't be hard unless you accidentally copy every row. See below and note the &s
// assuming C++11
vector matrix; //assuming that's what you have
for (auto& row : matrix)
for (auto& cell : row)
nizzle(row);

keep fighting the good fight, brotha

>nizzle(row)
shouldn't you be shizzling the cell nizzle?

webdevs are disgusting

A sizable enough program with MMM will eventually require some form of a GC.

Looks like both D and Nim's GC run only when allocation happens, instead of a certain periodic collection. The memory is reclaimed after collection too.

Fi shizzle ma nizzle.

*nizzle(cell);

people.cs.umass.edu/~emery/pubs/gcvsmalloc.pdf
> In particular, when garbage collection has five times as much memory as required, its runtime performance matches or slightly exceeds that of explicit memory management. However, garbage collection’s performance degrades substantially when it must use smaller heaps. With three times as much memory, it runs 17% slower on average, and with twice as much memory, it runs 70% slower. Garbage collection also is more susceptible to paging when physical memory is scarce. In such conditions, all of the garbage collectors we examine here suffer order-of-magnitude performance penalties relative to explicit memory management.

And NIm's GC is actually able to be toggled freely, whereas D's @nogc comes with major caveats.

>muh 10MB program would run 17% slower on a 32 MB box, oh no

vector v1;
//load v1 with values
vector :: iterator it1;
vector :: iterator it2;

for(it1 = v1.begin(); it1 != v1.end(); v1++)
{
for(it2 = it1->begin(); it2 != it1->end(); it2++)
{
//do stuff but doesn't seem to work
}
}

May be wrong in terms of syntax but even when it compiles it doesn't work.

>people.cs.umass.edu/~emery/pubs/gcvsmalloc.pdf
You do realize Java's GC algorithms are not the only ones out there, right?

I bet you think Electron was a good idea.

this is what foreach was invented for:

>actually writing out iterator type names
>not using range-based for loops
y-you... you are using C++11, right?

Doesn't explain how Emacs manages to be BOTH memory hoggy and slow at the same time

>spend multiple times more time & budget to bring product to all platforms due to autism
>wonders why bankrupt
oh man, you sure showed me

>GNU project
>from original GNU lisp meme coder
>memory hoggy and slow
>eight megabytes and constantly swapping
yeah, big surprise there
have you actually seen gnu-quality code?

Java's GC has thousands of human-years invested in it, it's the state-of-the-art GC which has been used in production for decades. If you think D's or Nim's (or Go's for that matter) toy GCs are anywhere close to it in terms of efficiency you're delusional.

>What is LIsp

I can see compile time errors already but I am going to ignore them as you said it's not the point. Define "doesn't seem to work" and post actual code that doesn't work otherwise the spoonfeeding can't proceed

>Enterprise FizzBuzz has thousands of human-years invested in it, it's the state-of-the-art FizzBuzz which has been used in production for decades. If you think your 10-liner toy FizzBuzz is anywhere close to it in terms of efficiency you're delusional.

Read barriers are very expensive. Poor Java.
Garbage collected programs are often faster.
Destructors are used to deallocate resources acquired by an object. For most classes, this resource is allocated memory. With garbage collection, most destructors then become empty and can be discarded entirely.
All those destructors freeing memory can become significant when objects are allocated on the stack. For each one, some mechanism must be established so that if an exception happens, the destructors all get called in each frame to release any memory they hold. If the destructors become irrelevant, then there's no need to set up special stack frames to handle exceptions, and the code runs faster.
Garbage collection kicks in only when memory gets tight. When memory is not tight, the program runs at full speed and does not spend any time tracing and freeing memory.
Garbage collected programs do not suffer from gradual deterioration due to an accumulation of memory leaks.

Garbage collectors reclaim unused memory, therefore they do not suffer from "memory leaks" which can cause long running applications to gradually consume more and more memory until they bring down the system. GC programs have longer term stability.
Garbage collected programs have fewer hard-to-find pointer bugs. This is because there are no dangling references to freed memory. There is no code to explicitly manage memory, hence no bugs in such code.
Garbage collected programs are faster to develop and debug, because there's no need for developing, debugging, testing, or maintaining the explicit deallocation code.

>he doesn't understand the difference between enterprise projects in Java and JVM itself
It's not even written in Java, m8, it's pure C++ + asm.