/dpt/ — Daily Programming

Previous: What are you working on, Jow Forums?

Attached: 1526342735478.png (917x1115, 112K)

Other urls found in this thread:

catb.org/jargon/html/N/nasal-demons.html
blogs.msdn.microsoft.com/dotnet/2018/04/18/performance-improvements-in-net-core-2-1/
pdfs.semanticscholar.org/b57a/af581e043fb63c56ebd662720190e3121220.pdf
stackoverflow.com/q/17134522
github.com/frol/completely-unscientific-benchmarks
blogs.msdn.microsoft.com/dotnet/2018/05/07/net-core-3-and-support-for-windows-desktop-applications/
github.com/n4n0GH/chan-scraper
citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.368.1058&rep=rep1&type=pdf
github.com/JIMcCann/Sooty
stackoverflow.com/questions/8250889/speed-comparison-between-fgetc-fputc-and-fread-fwrite-in-c
twitter.com/SFWRedditVideos

Going through the SICP lectures to find a timestamp that explains why user's "first class macros" is a silly idea.

Ok. Thanks you both.

Attached: 83228248161507.jpg (471x390, 40K)

The string "hello world" is usually immutable. Try modifying it and the kernel will bitch slap you.

i'm not kidding about the nasal demon part.

catb.org/jargon/html/N/nasal-demons.html

What's a good project for beginners? What language to use + what to try and make with it?

>being such a try hard
You need to fix that butthurt, javeesh

mfw those javafag got butthurt by .net core

Attached: 1525192215784s.jpg (211x250, 9K)

Read the little schemer. It's a fun little exercise book that ends with a cool program called the "metacircular evaluator" that run its own source code for program within a program eval-ception.

>imagine being slower than Java

How much of a beginner? If you are bored of making calculators, learn to create a GUI and IO (disk and internet)
C# is easy for beginners though C is probably the best start to learn memory management

how do you navigate python docs?
if i just want the run down of what a function does, the errors it can raise, etc. how do i get that efficiently?

JVM is actually pretty good for what it is. Too bad it can't compete with monsters like C++, Rust or D.

We are going nano second and zero allocations
>blogs.msdn.microsoft.com/dotnet/2018/04/18/performance-improvements-in-net-core-2-1/
Meanwhile javeesh thinks 'functional' interface is a delegate KEK

Attached: 1526307770426.png (1920x1080, 1.03M)

>text editor and language compiler version matches

Attached: afc854e3321dc5b0729308dc708e24bfe58a76b7_hq.jpg (552x364, 19K)

I didn't mean to reply you, I was talking to this other user .
Interesting link though.

>JVM is actually pretty good
Are you sure about that? Because last time I checked:
>pdfs.semanticscholar.org/b57a/af581e043fb63c56ebd662720190e3121220.pdf
and
>stackoverflow.com/q/17134522

Haven't programmed in a while.
Give me an simple or intermediate challenge to do.

FizzBuzz

Yes, JVM is actually pretty good. It's cross platform and efficient. As a result Java is faster than C# in any non-rigged benchmarks.

Too easy and I remember the steps on how to do it.

holy shit, why is Python so slow???

Attached: 1129294958856.jpg (433x380, 40K)

whats the overhead in c++ unique_ptr compared to raw pointers? are they not calling the destructor with the raw pointer? is it a virtual call?

well you also have to std::move shit around too with unique ptrs.

But here it is anyways.

Attached: Capture.png (673x425, 18K)

here's what i found in a job interview
3025 is a magic number
because 30 + 25 = 55, 55^2 = 3025
find other 16 digit numbers which qualify this pattern

>BTFO Swift

>rigged
LOL sore loser.
Those 'rigged' benchmarks always happen to have their source code and OS specs (e.g the benchmark games site) I surely wonder where is the source code for OP image.

Attached: 1492032243977.jpg (1280x1707, 317K)

I am pretty sure spouting random images on the otherhand is considered a valid result, right?

Java BTFO!
Even slower than xamarin on fucking android!

sample output for 4 digits:
0000
0001
2025
3025
9801

noice :D
is that LISP?

sample output for 8 digits:
00000000
00000001
04941729
07441984
24502500
25502500
52881984
60481729
99980001

>I surely wonder where is the source code for OP image.
github.com/frol/completely-unscientific-benchmarks

I'll check it out, thanks.
I've done basic web development, but it was for stuff I needed. Now I don't really need anything anymore, I don't have any goals to work towards, but I still want to create something, I just don't know what. I guess I'll build a calculator in javascript or something. GUI, IO and memory management is probably too advanced at this point.

There is more! .net core 2.1 is a month old! That is too old!
Time to focus on the future: .net core 3
>blogs.msdn.microsoft.com/dotnet/2018/05/07/net-core-3-and-support-for-windows-desktop-applications/
They were able to run paint.net without any modifications and enhanced startup times.

Who did this abomination? Jesus christ.

ur dad

double noice :D
those javafags used to bully me alot since 10 years ago. now it's my turn to bully them lol

Some guys want reddit points

Like this user said , but that move overhead is basically the same as setting the old value to null in addition to copying the pointer, so not much.

>write codes like a script kiddie
>results are only better for the PL he knows most
Oh NO no no no!

Same "defense" goes for Java too. What point are you trying to make here?

I really wonder what it means when an unexperienced programmer makes a benchmark. Too bad alioth debian benchmark games is down (but the results are on the archives)

>I really wonder what it means when an unexperienced programmer makes a benchmark.
The repo is open for pull requests.

As if javeesh can build decent GUI desktop programs. Their "new" GUI framework JavaFX uses 80 MB for a simple form.
Even on the web ASP is second most widely used framework

unscientific benchmark

>but the results are on the archives
I don't think it goes in favor of any of the two. Except for the two cases where Java blows C# out with clear wins

You know it.
I've got the predicate function working and that's what really matters.

Attached: Capture.png (917x654, 58K)

It was all win for C# except the regex (because of IL emit). Too bad we couldn't see Core 2.1 results

it seems the result are mixed with different digits length. eg 07441984 should not appear with 3025. because 3025 = 4 digits while 07441984 is 8 digits. but i guess you do the calculation correctly.

here's the 16 digits result:
0000000000000000
0000000000000001
0030024405179209
0066616807495744
0123456809876544
0186086811780496
0275246813838096
0371449415558529
0390974415863329
0612685018625625
0637690018875625
0953832821345856
1322314023140496
1511956823764321
1968106024682281
1982524424700304
2499500025000000
2500500025000000
3077414824700304
3095437824682281
3735179023764321
4049586823140496
4776996021345856
5587185018875625
5662190018625625
6436359815863329
6516844815558529
6957134013838096
7457814011780496
7901234409876544
8434234407495744
8934133805179209
9999999800000001

The problem is how to write efficient code for this problem. brute force is big no-no. too long.

when finding for n digits, all numbers must be zero padded to become n digits. eg. 0 becomes 0000 for 4 digits result.

Attached: Screenshot-2018-5-15 C# NET Core vs Java - Which are faster Computer Language Benchmarks Game.png (1176x637, 49K)

I'm building a simple downloader for my terminal so I can SSH into my homeserver and have it download thots and such things.

github.com/n4n0GH/chan-scraper

It still needs some work though, because it's not aimed at just Jow Forums. I want it to handle any arbitrary website or chan. Currently that works until you throw non-ascii characters into the filename. Also I want it to be compatible with Python 2.7 and Python 3.x

Attached: Screenshot_20180515_091233.png (444x175, 7K)

2.1 would have made it lighter and faster.
Oh well

Should 0 padded-at-left numbers even be allowed?

What other approach could there be but brute force.

hint:make a cheat sheet

it took like 5 minutes to compute all 8 digits in my old laptop (dual core + 4 GB RAM) using brute force. it took less than a second with a cheat sheet.

I know of a massive speedup for your problem with modulus arithmetic, but it's still O(e^n).

how do you use modulus arithmetic?

>3025 is a magic number
>because 30 + 25 = 55, 55^2 = 3025
I still don't get what a magic number is

Are you retarded?Just brute force x^2 and check the condition of zzyy where zz + yy = x^2

3025 is 4 digits number. so tear it into 2 part in the middle: 30 and 25 (both 2 digits).
30 + 25 = 55
55 * 55 = 3025
see?

another example 6 digits:
494209, tear it into 494 and 209
494 + 209 = 703
703 * 703 = 494209

see the pattern?

Oops I mean where zzyy = x^2 and zz + yy = x

try brute force for 8, 10, 12, 14, 16 digits
see how long it computes
2, 4, 6 digits number are fine to brute force

Hmm.
xxyy = 494209 => 494 209 => 4 + 9 = (1)3 (rightmost of x) => 3 * 3 = 9 => rightmost of zzyy => possible hit?

i recant my claim actually, I just got fucked by quadratic residues.

what do you mean? give an example.

>4 + 9 = (1)3 (rightmost of x) => 3 * 3 = 9 => rightmost of zzyy => possible hit?
i don't get it
see my prev post

I am retarded nvm

Late to reply, but the guy who ran the tests I think said in his Reddit thread he isn't really that experienced with Nim, and I think he forgot to set the release flag

>Your chances of meeting someone who finds you attractive are as real as me!
But Ai, you don't exist.

that's the joke
forever ronery

>fgetc eight times and comparing eight times
Isn't this slower? I thought using fread and comparing once would be faster

8 digits brute force vs cheat sheet using i5 4 GB RAM
7.602 s vs 0.002 s

for 10 digits:
2 minutes only get 5 results (aborted) vs 0.013 s

12 digits: 0.134 s
14 digits: 1.279 s
16 digits: 12.925 s

it seems i was wrong when i said it took 5 minutes for 8 digits in dual core. i don't remember, it was like 5 years ago.

code is in c# and tested in linqpad. must be faster in c/c++.

Hmm.. On linux maybe because fread maps to direct system calls or something like that last time I checked.
I used to do that to avoid the cost of copying which turned out well on windows especially when the buffer is large.
I never tried for smaller buffers.

Redpill me about why should I learn Haskell other than "For the memes"

lenses

Attached: haskthink.png (198x183, 6K)

to impress Jow Forums

Brute force only digits with half the requested length?
Avoid high level langs for IO because they do lots of shit for abstraction and security.
In C# you can use pointer arithmetic to speed things up (especially useful for mul) and you should wrap your native IO functions using DllImport (two lines)

it's quite fast with the cheat sheet. the brute force take 2 minutes and i aborted. while it takes a few ms to complete with cheat sheet.

if mul means multiplication. you are absolutely right.

i made improvement. Math.Pow(x, 2) is slower than x * x. for 16 digits it takes 9.136 seconds now.

Because you want to efficiently and productively program robust applications which produce fewer bugs, while improving readability and extensibility of software with functional composition and monads, without the structural rigidity of object orientated languages, allowing you to become a more productive programmer.

Source:
citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.368.1058&rep=rep1&type=pdf

Do a left shift

redpill me on "ocl"

isn't that multiply by 2?
i was talking about square or power of 2.

tried in ideone.com and it takes 3 seconds to calculate 16 digits

Maybe I should stop posting for tonight

x

boyos r8 my shitty ruby program made by me who doesn't know how github works

github.com/JIMcCann/Sooty

Attached: topperino kekkuccino.png (3840x2160, 903K)

Is there an easy way to plot the 68% contour of a large (several MB) dataset in python?

>wanting it to be compatible with Python at all
why dont you want it to be compatible with a good language instead?

still doing the code for my problem?

i think i put this in the wrong thread
can anyone here help please?

Here's a decent SO Post describing what goes on under the hood, so it's unlikely that for small buffers there will be too much of a difference

stdio functions will fill a read buffer, of size "BUFSIZ" as defined in stdio.h, and will only make one read(2) system call every time that buffer is drained. They will not do an individual read(2) system call for every byte consumed -- they read large chunks. BUFSIZ is typically something like 1024 or 4096.

stackoverflow.com/questions/8250889/speed-comparison-between-fgetc-fputc-and-fread-fwrite-in-c

D DMD: 9.432905226 seconds time elapsed
D GDC: 25.970303586 seconds time elapsed
D LDC: 6.347934615 seconds time elapsed

C++ clang++: 5.518077517 seconds time elapsed
C++ G++: 4.659448453 seconds time elapsed

Go Go: 33.553163084 seconds time elapsed
Go gccgo: 17.438276362 seconds time elapsed

Nim: 6.083644424 seconds time elapsed
Rust rustc: 6.583698221 seconds time elapsed
Haskell GHC: 0.454930841 seconds time elapsed
Java OpenJDK: 1.189619693 seconds time elapsed
Scheme Gambit: 1.932229635 seconds time elapsed

Attached: ready_to_kill.png (560x530, 176K)

Haskell is my langfu

Attached: hasyuno.png (1280x720, 500K)

Speaking broadly, framework is a skeleton on which you build your programs. That seems a little bit vague, but the same can be said the idea of a "framework." There are many different kinds of frameworks. For example, Django is a web framework, so it provides a skeleton for building web apps. .Net is a runtime environment and a set classes that you can use for general-purpose programs. So comparing these two is like comparing apples and oranges. Of course, there are frameworks which share the same purpose, an example would be Django and Ruby on Rails (both are web frameworks). That's when comparing them makes sense.

>no murder option
it's shit t.b.h sesu denpai