-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the majority-element wiki!
To build and run:
make
To clear out the binaries:
make clean
I wrote programs in different languages that
- Read in a csv file with a single line,
- parse the line into an array of strings,
- iterate over the array and keep a count of the occurrences of each unique element,
- report if some element occurs more than half of the time
This is incredibly unscientific and a very basic test to boot. The goal is for me to get some kind of sense of how fast different languages are, and to try different ones out with a common solution to a simple problem. I wouldn't read too much into this as a benchmark.
https://travis-ci.org/dahofer/majority-element/builds/70553560
I wasn't able to find a way to read from a file in Swift when compiled to an OS X binary (I guess it's possible as an iOS binary). Haskell seems to have trouble parsing the medium-sized file (~7MB). I like Haskell but I don't love it, so I probably won't debug it, but if someone knows what's going on I'd happily accept a fix.
If I am abusing a language, or there's a faster way to do something, let me know.