System.currentTimeMillis() vs. new Date() vs. Calendar.getInstance().getTime()

System.currentTimeMillis() is obviously the most efficient since it does not even create an object, but new Date() is really just a thin wrapper about a long, so it is not far behind. Calendar, on the other hand, is relatively slow and very complex, since it has to deal with the considerably complexity and all the … Read more

Making the Android emulator run faster

Official web page ~50% faster Windows: Install “Intel x86 Emulator Accelerator (HAXM)” => SDK-Manager/Extras Install “Intel x86 Atom System Images” => SDK-Manager/Android 2.3.3 Go to the Android SDK root folder and navigate to extras\intel\Hardware_Accelerated_Execution_Manager. Execute file IntelHaxm.exe to install. (in Android Studio you can navigate to: Settings -> Android SDK -> SDK Tools -> Intel … Read more

Condition within JOIN or WHERE

The relational algebra allows interchangeability of the predicates in the WHERE clause and the INNER JOIN, so even INNER JOIN queries with WHERE clauses can have the predicates rearrranged by the optimizer so that they may already be excluded during the JOIN process. I recommend you write the queries in the most readable way possible. … Read more

What blocks Ruby, Python to get Javascript V8 speed? [closed]

What blocks Ruby, Python to get Javascript V8 speed? Nothing. Well, okay: money. (And time, people, resources, but if you have money, you can buy those.) V8 has a team of brilliant, highly-specialized, highly-experienced (and thus highly-paid) engineers working on it, that have decades of experience (I’m talking individually – collectively it’s more like centuries) in … Read more

Which part of throwing an Exception is expensive?

Creating an exception object is not necessarily more expensive than creating other regular objects. The main cost is hidden in native fillInStackTrace method which walks through the call stack and collects all required information to build a stack trace: classes, method names, line numbers etc. Most of Throwable constructors implicitly call fillInStackTrace. This is where … Read more