[JAVA] Basic level performance evaluation of programming languages

Tested on my iMac (27-inch, Late 2012) Processor : 3.2 GHz Intel Core i5 Memory : 16 GB 1600 MHz DDR3

Name Numerical calculation(1 million times) ms String concatenation(1 million times) ms Remarks
c 2 10 strcpy
cpp 2 22 std::string.append
string+string leads to no response
go 0.5 13 bytes.Buffer.WriteString
strings.Join spends 80ms+
NOTICE: in fact "go run" waste much time, it can be proved by exec "time go run test.go" on your shell
java 6 6 35 StringBuilder
OBJC 2 45 NSString stringByAppendingString:TIMEOUT
NSMutableString appendFormat:246ms
NSMutableArray componentsJoinedByString:129ms
NSMutableString appendString:63ms
CFMutableStringRef appendString:52ms
CFStringRef[]=>CFArrayRef join appendString:45ms
* the speed under command line & iOS simulator are almost same.
php 5.4 36 56 with APC
./test.php but not php test.php
swift 2.1.1 5 62 swiftc test.swift -o test
./test
nodejs 5.5.0 2 65 str becomes 1.5 times faster than 0.8
scala 2.0 4.5 76 no java.lang.stringBuilder no response!!!
nodejs 0.8.22 2 95
ruby 2.0.0 141 185 str1 << str2 : 185
str+str no response
lua 5.2.1 40 225 table.insert/concat
groovy 2.2.1 239 227 str<<=str2
older version have to use java.StringBuilder?
python 2.7.2 213 247 arr.append->join
pyc has almost a same result
perl 5.12 144 288
ruby 1.8.7(REWROTE) 140 286 arr.join
js/ff22 2 34 (+ on ff is amazing), innerHTML is pretty fast
it does not mean html render is fast either.
js/chrome 2 110
js/safari6 62 112
js/opera12 180 250

Recommended Posts

Basic level performance evaluation of programming languages
Basic writing of various programming languages (self-memo)
Features of programming languages [Memo]
The popularity of programming languages
Network programming (basic)
Performance evaluation index
Transition animation of the most popular programming languages (#programming languages #popular)
Performance evaluation of investment automatic trading bot using backtesting
[Note] Beginning of programming
Basic operation of pandas
Basic usage of flask-classy
Basic usage of Jinja2
Basic operation of Pandas
Basic usage of SQLAlchemy
Basic knowledge of Python
Basic processing of librosa
[For beginners] A word summary of popular programming languages (2018 version)