Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are java algorithms implemented in C or in java?

I know that python's implementation of sorting (timsort) is implemented in C to get better performance. Is that also the case for the java implementation, or are all java algorithms implemented in java?

like image 928
sighol Avatar asked Nov 24 '11 09:11

sighol


2 Answers

The majority of the standard library is typically implemented in Java. That said, a lot of OS or platform specific functionality has to be implemented in "native" code, so a good percentage is also typically written in C and/or C++. It does depend a bit on the particular JVM implementation, of course.

Typical functionality implemented in languages other than Java includes threading, network I/O, file I/O, and the low-level UI API. Note that these are all pretty low-level, specific features though - the more abstract/general algorithms are ideally suited to implementation in Java, and therefore typically are.

like image 150
Mac Avatar answered Sep 22 '22 18:09

Mac


Most of the Java library is implemented in Java, including the sort algorithm

like image 40
unbeli Avatar answered Sep 25 '22 18:09

unbeli