Showing posts with label haskell. Show all posts
Showing posts with label haskell. Show all posts

2021-07-08

Prime Benchmark

So, yesterday I didn't touch my PC to do a prime number benchmark. And Here's the result for single threaded (only showing fastest implementation of each language) and multithreaded:

IndexImplementationSLabelPassesDurAlgoFaithfulBitPasses/Second
1cpp3flo80_2206675.00baseno144133.26760
10c2daniel202505.00wheelyes14049.85259
11zig3ManDeJ179645.00baseno13592.49823
12c2daniel176815.00wheelyes13536.07129
16rust1mike-b158045.01baseyes83152.68929
20assembly1rberge144345.00baseno82886.80000
22haskell1fatho/119595.00baseno82391.77321
32fortran1johand99875.00baseno11997.40000
36crystal1marghi86805.00baseyes11735.86981
38fsharp3dmanno77545.00baseyes1550.68897
40java1Mansen1488710.0baseyes1488.70000
41csharp1kinema72715.00baseyes1454.08077
43julia2epithe69535.00baseyes11390.55577
46go2ssoves61615.00baseyes11232.01471
51nodejs1rogier57485.00baseyes11149.43213
57lisp2mayerr51225.00baseno11024.19803
58typescript1marghi50315.00baseyes1006.20000
59d2Bradle50035.00baseyes11000.52396
61v1marghi43295.00baseyes865.80000
63lua2ben1je31595.00baseno1631.80000
64nim2beef3328715.00baseyes1574.02096
67cython1rpkak26595.00baseyes8531.64832
71basic1rberge24165.00wheelyes1483.00680
73assemblyscript1donmah423110.0baseyes423.05768
74python2ssoves19915.00baseyes8398.09742
80scala1rom1de12035.00baseyes240.55189
81pascal1rberge11625.00baseyes232.40000
82cobol1fvbake11575.00baseno8231.40000
83pony1marghi11445.00baseyes1228.80000
84swift1j-f1204610.0baseyes204.55332
85dart1eagere8245.00baseyes164.77795
86haxe1TayIor139210.0baseyes139.19035
88ada1BoopBe6615.00baseno132.02220
92octave1octave3135.00baseno62.54234
93postscript1epithe2165.01baseno843.08797
94ruby1rberge1195.01baseyes23.71935
95wren1marghi1115.00baseyes22.16446
96php1Dennis14310.0baseyes14.24667
97smalltalk1fvbake495.07baseyes19.66469
99mixal1rberge304.91baseno16.10998
100perl1marghi285.16baseyes5.42031
103r1fvbake75.43baseyes321.28842
104sql2fvbake65.43otherno321.10375
105tcl1fvbake65.47baseyes11.09589
111latex1tjol217.8baseno320.11224
112bash1bash110.6baseno0.09357

IndexImplementationSLabelPassesDurThreadAlgoFaithfulBitPasses/Second
1zig3ManDe1409105.04wheelno17045.26046
2cpp3flo802361845.08baseno15904.57992
3zig3ManDe1063995.04wheelno15319.64146
4zig3ManDe1010265.04wheelno15051.08785
5zig3ManDe840025.04wheelno14200.08320
6zig3ManDe1478225.08wheelno13695.38740
7zig3ManDe720215.04wheelno13600.73314
8zig3ManDe705225.04wheelno13525.83204
9zig3ManDe1341245.08wheelno13352.91894
10zig3ManDe598515.04baseno82992.45424
11c2danie1013915.08wheelyes12534.43285
12zig3ManDe982465.08wheelno12455.98299
13zig3ManDe981905.08wheelno12454.57327
14zig3ManDe481645.04baseno12408.10849
15zig3ManDe917455.08wheelno12293.50574
16zig3ManDe905985.08wheelno12264.84129
17c2danie881035.08wheelyes12199.97727
18zig3ManDe423185.04baseno12115.85768
19c2danie788585.08wheelyes11969.05838
20zig3ManDe684925.08baseno81712.11852
21c2danie637525.08wheelyes11591.86334
22rust1mike-590015.08baseyes81474.83765
23rust1mike-529795.08baseyes11324.32205
24c2danie498225.08baseyes11244.43126
25zig3ManDe497125.08baseno11242.59124
26c2danie246645.04wheelyes11233.15067
27rust1mike-492385.08baseyes11230.78145
28zig3ManDe456365.08baseno11140.80189
29c2danie223785.04wheelyes11118.88478
30c2danie203855.04wheelyes11019.22065
31c2danie202575.04wheelyes11012.82346
32c2danie151325.04baseyes1756.55294
33cpp2davep200485.08baseyes1501.18496
34d2Bradl195535.08baseyes1488.74973
35zig3ManDe92405.04baseno8461.94272
36zig3ManDe118345.08baseno8295.81332
37csharp1kinem31935.08wheelyes179.81766
38csharp1kinem29615.08baseyes174.02041

Raw result on this gist

2016-11-30

Websocket Benchmark

Once again, today I found another benchmark, about websocket:

Round #1

Language Clients RAM (MB) RAM / Client (KB) LOC Library
C++ 33,000 600 18.62 140 https://github.com/zaphoyd/websocketpp
Clojure  27,000 1,500 56.89 50 http://www.http-kit.org/
Elixir 24,000 1,900 81.07 20 http://www.phoenixframework.org/
Go 24,000 800 34.13 100 Built-in golang.org/x/net/websocket
NodeJS 13,000 300 23.63 31 https://github.com/websockets/ws
JRuby 1,100 650 605.09 20 http://rubyonrails.org/
Ruby 500 150 307.20 20 http://rubyonrails.org/

Round #2

Language Version Thread Clients Clients (without Payload)
Javascript / Node / uws 6.6.0
26,000
Haskell - no chan 1.2
25,000 37,000
C++ / uWebSockets / RapidJSON 5.4.0 1 24,000 35,000
Go / Websocket 1.7
22,000 39,000
C++ / Crow / RapidJSON 5.4.0 1 20,000
Go / Gorilla 1.7
20,000
Java / Netty 1.8.0_101
20,000
Rust - ws 1.11.0
20,000
Elixir / Plug 1.3.2
19,000
Java / Undertow 1.8.0_101
19,000
NodeJS / Faye - clustered 6.6.0
19,000
Rust - scopedpool-ws 1.11.0
19,000
Clojure / Java 1.8.0_101
18,000
C++ / WebsocketPP / jsoncpp 5.4.0 8 17,000
JRuby / Eventmachine 9.1.2.0
17,000
Rust - threadpool-ws 1.11.0
17,000
Elixir / Phoenix 1.3.2
15,000
C++ / Crow / RapidJSON 5.4.0 8 14,000 42,000
Javascript / Node / ws 6.6.0
14,000
Javascript / Node / ws - clustered 6.6.0
14,000
C++ / WebsocketPP / jsoncpp 5.4.0 1 13,000
Haskell 1.2
13,000
NodeJS / Faye 6.6.0
13,000
Ruby / Eventmachine 2.3.1p112
13,000
Javascript / Node / uws - clustered 6.6.0
12,000
JRuby / Rails 9.1.2.0
1,000
Ruby / Rails 2.3.1p112
500

You can see the raw result here.


2016-06-19

Flowchart to choose your programming language

Just now, I found a cool site to generate flowchart from source code (just like dot program):

(click for larger picture)

Anyway this just a joke, just like before (if programming language were religion/woman), may odds be in your favor..

Btw here's the code if you want to modify.. please use http://pastie.org if you want to do a long comment containing source code..

Choosing Programming language flowchart;
if(I really really care 
about runtime performance) {
  if(I am masochist..) {
    if(I like Mozilla..) {
      Use Rust;rust-lang.org
    } else {
      Use C++;cplusplus.com
    }
  } else if(I don't want 
  to learn something new..) {
    Use C;cprogramming.com
  } else if(I like long lines..) {
    Use Java;java.com
  } else if(I like FP?) {
    if(But I'm not masochist..) {
      Use Scala;scala-lang.org;
    } else if(I like parentheses..) {
      Use Clojure;clojure.org
    } else if(I like Microsoft) {
      Use FSharp;fsharp.org;
    } else {
      Use Haskell;haskell.org;
    }
  } else { 
    if(I like Microsoft..) {
      if(I hate C++) {
        if(My computer is ancient..) {
          Use VB6;
        } else {
          Use VB.NET;
        } 
        vbforums.com;
      } else {
        Use CSharp;csharp-station.com;
      }
    } else if(I like Facebook..) {
      Use Hack;hacklang.org;
    } else if(I like Apple..) {
      if(I'm a bit masochist..) {
        Use Objective-C;developer.apple.com;
      } else {
        Use Swift;swift-lang.org;
      }
    } else if(I like Google..) {
      if(But I also like java 
      and javascript..) {
        Use Dart;dartlang.org;
      } else { 
        Use Go;golang.org;
      }
    } else {
      // you can also use Lazarus
      // lazarus.freepascal.org
      Use Delphi;embarcadero.com;
    }
  } 
} else {
  if(I don't want to install a thing..) {
    if(I use linux, mac, or win 10) {
      Use Bash;bash-hackers.org;
    } else {
      Use Javascript;javascript.com;
    }
  } else if(I love spaghetti..) {
    if(I don't care about my future..) {
      // Most likely you will be killed by maintainer that reads your code..
      Use Perl;perl.org;
    } else {
      Use PHP;php.net;
    }
  } else if(I want to make game mods..) {
    Use Lua;lua.org;
  } else if(I like indentations..) {
    Use Python;python.org;
  } else {
    Use Ruby;ruby-lang.org;
  }
}

Aww snaps, I forgot to add Elixir, Julia, and Crystal  -_- oh well.. maybe sometime in the future.

2015-12-21

If Programming Language were Woman

A sexist joke..


PHP is your teenage sweetheart, the girl you first awkwardly fumbled around with that one summer. Just don't try and start a more serious relationship - this girl has serious issues.

Perl is PHP's older sister. She might be a bit old for you, but she was pretty popular back in the 90s. In a long-term relationship with Larry Wall, so her standards have dropped, and she's looking seriously fugly now. "I don't care what y'all say, I still love her!", he says. No-one else does.

Ruby is the cool kid of the scripting family. When you first saw her, she took your breath away with her beauty. She was fun, too. At the time she seemed a bit slow and ditzy - though she's matured a lot in the last few years.

Python is Ruby's more sensible sister. She's elegant, classy, and sophisticated. She's perhaps too perfect. Most guys are like "dude, how can you not like Python!?". Sure, you like Python. You just consider her the boring version of the edgy and romantic Ruby.

Java is a successful career woman. Some people who've worked with feel she owes her position less to ability and more to her knack for impressing the middle-management types. You might feel that she's the sensible type you should settle down with. Just prepare for years of "NO THAT DOESNT GO THERE GOD YOU ALWAYS USE THE WRONG TYPE INTERFACE AND YOU MISSED A SEMICOLON" nagging.

C++ is Java's cousin. Similar to Java in many ways, the main difference being she grew up in a more innocent time and doesn't believe in using protection. By "protection", I mean automatic memory management, of course. What did you think I meant?

C is C++'s mom. Mention her name to some old grey beard hackers and they're sure to reminisce with a twinkle in their eye.

Objective C is another member of the C family. She joined that weird church a while back, and won't date anyone outside of it.

Haskell, Clojure, Scheme and their friends are those hipster, artsy, intellectual girls you probably spent a blissful college summer with a few years ago. The first girls who really challenged you. Of course, it could never have become something more serious (you tell yourself). Though you'll always be left asking "what if?"

You might be put off C# due to her family's reputation. But they've gone legit, the last few years, they tell you. Once you're one of us, you're one of us, you hear? You need a database? Her brother MSSQL will hook you up. Need a place to stay? Heck, her daddy will even buy you your own mansion on Azure avenue. What's that, you're having second thoughts about all these overly friendly relatives? No, you can never leave. You're part of the family, now, ya hear?

Javascript - hey, wasn't that the girl you first kissed, way before even PHP came on the scene? I wonder what she's doing now. I hear her career's really taken off in the last few years. Would be cool to catch up some time, if only for old time's sake... (You catch sight of her, dressed head to toe in designer jQuery)... wow, somebody grew into a beautiful swan...e else does.

Reblogged from utest.

Let's add some more..

VB, C#'s little sister that easier to talk to, she was quite ugly back then (VB6).

Go, new kids on the block, quite mature for her age.

Delphi, the successful career woman that anyone forgotten or leave for family reasons, but deep down inside we know that we could achieve more with her.

Check the previous blogpost about if programming language were religion.

2015-02-10

If Programming Languages were Religions

This is old (2008) but still fun to re-read ^_^;;
Re-blogged from higherorderfun (Rodrigo Monteiro).
(Inspired by “If programming languages were cars“)
See other comparison about programming language and anything here.

C would be Judaism - it’s old and restrictive, but most of the world is familiar with its laws and respects them. The catch is, you can’t convert into it – you’re either into it from the start, or you will think that it’s insanity. Also, when things go wrong, many people are willing to blame the problems of the world on it.

Java would be Fundamentalist Christianity – it’s theoretically based on C, but it voids so many of the old laws that it doesn’t feel like the original at all. Instead, it adds its own set of rigid rules, which its followers believe to be far superior to the original. Not only are they certain that it’s the best language in the world, but they’re willing to burn those who disagree at the stake.

PHP would be Cafeteria Christianity – Fights with Java for the web market. It draws a few concepts from C and Java, but only those that it really likes. Maybe it’s not as coherent as other languages, but at least it leaves you with much more freedom and ostensibly keeps the core idea of the whole thing. Also, the whole concept of “goto hell” was abandoned.

C++ would be Islam - It takes C and not only keeps all its laws, but adds a very complex new set of laws on top of it. It’s so versatile that it can be used to be the foundation of anything, from great atrocities to beautiful works of art. Its followers are convinced that it is the ultimate universal language, and may be angered by those who disagree. Also, if you insult it or its founder, you’ll probably be threatened with death by more radical followers.

C# would be Mormonism - At first glance, it’s the same as Java, but at a closer look you realize that it’s controlled by a single corporation (which many Java followers believe to be evil), and that many theological concepts are quite different. You suspect that it’d probably be nice, if only all the followers of Java wouldn’t discriminate so much against you for following it.

Lisp would be Zen Buddhism – There is no syntax, there is no centralization of dogma, there are no deities to worship. The entire universe is there at your reach – if only you are enlightened enough to grasp it. Some say that it’s not a language at all; others say that it’s the only language that makes sense.

Haskell would be Taoism - It is so different from other languages that many people don’t understand how can anyone use it to produce anything useful. Its followers believe that it’s the true path to wisdom, but that wisdom is beyond the grasp of most mortals.

Erlang would be Hinduism – It’s another strange language that doesn’t look like it could be used for anything, but unlike most other modern languages, it’s built around the concept of multiple simultaneous deities.

Perl would be Voodoo – An incomprehensible series of arcane incantations that involve the blood of goats and permanently corrupt your soul. Often used when your boss requires you to do an urgent task at 21:00 on friday night.

Lua would be Wicca – A pantheistic language that can easily be adapted for different cultures and locations. Its code is very liberal, and allows for the use of techniques that might be described as magical by those used to more traditional languages. It has a strong connection to the moon.

Ruby would be Neo-Paganism – A mixture of different languages and ideas that was beaten together into something that might be identified as a language. Its adherents are growing fast, and although most people look at them suspiciously, they are mostly well-meaning people with no intention of harming anyone.

Python would be Humanism: It’s simple, unrestrictive, and all you need to follow it is common sense. Many of the followers claim to feel relieved from all the burden imposed by other languages, and that they have rediscovered the joy of programming. There are some who say that it is a form of pseudo-code.

COBOL would be Ancient Paganism – There was once a time when it ruled over a vast region and was important, but nowadays it’s almost dead, for the good of us all. Although many were scarred by the rituals demanded by its deities, there are some who insist on keeping it alive even today.

APL would be Scientology – There are many people who claim to follow it, but you’ve always suspected that it’s a huge and elaborate prank that got out of control.

LOLCODE would be Pastafarianism – An esoteric, Internet-born belief that nobody really takes seriously, despite all the efforts to develop and spread it.

Visual Basic would be Satanism - Except that you don’t REALLY need to sell your soul to be a Satanist…

Thanks to jfs and other people on #aegisub for the suggestions. Keep in mind, this list is a joke, and is not meant to offend anyone. Also, if you’re a ******, please don’t kill me.

-- and some of the comments (butt-hurt people and flames filtered)

Well if you want to add JavaScript to the list, how about we class it under Black Magic. Seeing how it is something designed to help us achieve good, with unintentional consequences beyond our comprehension, plus it can be used by evil doers to control, spy and mess with the innocent. I personally use as little as possible JavaScript, resorting more to server side code if possible. Or Alcoholism, the more you do it, the more it rots your brain as you realize that functions are objects, your prototypes are polluting namespaces, and you just can't seem to get any closure. Or Jedi Religion. Those who master it can do anything.

What about Prolog? Surely that'd be Atheism (yeah - I know, not technically a religion, but you know what I mean) a completely rationalistic take on the programming universe by following scientific deduction.

Smalltalk is the ancient Egyptian religion. The Initiated know it already had all the important concepts working long ago and most popular modern languages are incomplete subsets of it that obsess over artificial restrictions of their own creation while entirely missing the reason their code exists in the first place. And the heart of your code will be judged against the Feather of Truth before it can join the message passing afterlife. Smalltalk would be Freemasonry: lots of companies know it and use it but are afraid to say they do because it is a competitive advantage to them. Therefore it is a close, near-secret society of users. Moreover Smalltalk programs use reflection as means to improve themselves, which is one of the key principles in freemasonry. Last but not least they are viewed by several other religions as ancient outcasts, but they know better and are still quietly changing the world and influencing others.

Machine Language is Animism - the belief that ultimately everything is made out of bits and on some level can be thought of as an executable.

Assembly Language is Shamanism - the idea that we can use symbols to more easily communicate with the binary world. Also that we can change the visible world by journying into the hidden realm by the use of debuggers. Or Assembly is Atheism... followers believe that whatever you do, there is only the reality on the chip. You shouldn't need intermediary or 'fake' rules to deal with the reality right in front of you, but they can be useful for guidance so long as you don't believe them. They believe if you can handle it, you are enlightened, but understand a human need for simplicity. Try to argue with them though, and you'll get an earful.

Delphi is obviously Catholic. We enjoy lots of structure, and the VCL/RTL protects us from making most windows calls directly. It was founded (created) by somebody who is said to have super-human (very good technical) abilities. It grew to a point where it had a lot of power and followers. Many things have changed since Delphi was founded and, somehow, it has managed to evolve and grow (Delphi for .NET), however, in the process, it has lost the consistency that characterized its earlier flavors. Due to gross mistakes in its leadership (yeah, Borland), Delphi has lost ground to newer religions like C#, dynamic languages and, of course, the Web; but it still manages to survive and grow within its possibilities. -- Pascal/Delphi is Church of England. Once having quite an extensive and radical following, it has since mellowed out a lot. These days its followers have mostly given up on converting the world to their point of view. It's looked down at with some bemusement by some of the bigger languages that see themselves as more serious. Has trouble attracting young people. Pascal is Catholicism, it's old, was meant as a universal language, developed in a town that has climate similar to Rome, a language with no actual compilers--only interpreters, a language in which most anybody who does any programming had to learn, a language that no one practices, a language with simple but very strict rules making it a very litigious language such that if you don't follow all of the rules all of the time to the minutest detail, you will never experience the joy of getting your program to actually run, only frustration, confusion and guilt.

Fortran would be like the Amish faith - there's a relatively small number of programmers that use it, they don't try to proselytize others into using Fortran (perhaps knowing it's futile), and if you weren't born into it (that is, it wasn't the first or second major programming language you learned) there's about zero chance you'll ever understand it (and if you do learn a little about it later in life, you'll shake your head and wonder how anyone could adhere to it). And yet its adherents refuse to let it die. Also if you have programmed in Fortran for years and then discover another language you like better you'll probably never go back, so it's likely those in the "Fortran forever" camp will shun you from then on (at least they will never admit that your new preferred language could possibly be better!). But no one denies that you can run Fortran successfully on horse-and-buggy era computers (metaphorically speaking, of course!) and if, someday, something (like an EMP) destroys all the semiconductor-based computers, the Fortran guys will probably be able to run their language on the old vacuum-tube based Univac computers, and will therefore be far ahead of their peers who need the modern semiconductor-based technology to accomplish anything!

Objective-C would be Jews for Jesus. They want to keep the old ways, and extend them in a lovey dovey easy-to-use ways.

Groovy is Emergent Christianity: it comes from Java, but it's much hipper, its adherents look down on the Java followers they're still friends with, and they're a lot less concerned about putting things into such rigid categories. It's also low on ceremony and can easily modify itself as needed.

RPG would be Jehovah’s Witnesses. RPG programmers are of the elite 144,000 left in the world (because there are only 144,000 left in the world) and believe we are in the last days of the present world and lots of people make fun of them for their beliefs and rigid standards

Applescript is an analogy to Shinto: It pervades everyday life on Mac OS X, has few requirements or taboos, has been around practically forever (it started life as Hypercard), and is easy to get your mind around. It also has Steve Jobs as its Amaterasu. The only problem: As Shinto is confined solely to Japan, so Applescript is confined solely to Mac OS X and is found nowhere else.

Postscript is like one of those weird native south american religions where you have to get completely mashed on psychoactive herbs to program in it and then spend the next two days solid vomiting

Forth is like Kaballah, learning it requires lots of meditation on stuff like number theory and the calculus of infinitesimals, and any written stuff on it sounds to the uninitiated to be solid gibberish, but once you know it you see that it's just a systemization of minimalism-worship.

Clojure would be Unitarian Universalism. Although technically based on Java, it looks more like an eccentric version of Lisp. Somehow, the Renaissance and Enlightenment managed to produce, on a foundation of Java, a language that has the spare simplicity, lack of doctrine, and freedom of Lisp, that nevertheless, somehow, is able to coexist peacefully and productively with Java, while also incorporating modern ideals found in neither.

Ada is Anglicanism. Created by fiat as the official language of the government but nobody really pays it much attention anymore.

Brainf*ck, I think, would be Discordianism. Is it a programming language disguised as a joke, or is it a joke, disguised as a programming language..?

Check the next blogpost, if programming langauge were woman.