How to find Java Heap Size and Memory Used (Linux)?

Each Java process has a pid, which you first need to find with the jps command. Once you have the pid, you can use jstat -gc [insert-pid-here] to find statistics of the behavior of the garbage collected heap. jstat -gccapacity [insert-pid-here] will present information about memory pool generation and space capabilities. jstat -gcutil [insert-pid-here] will … Read more

Are list-comprehensions and functional functions faster than “for loops”?

The following are rough guidelines and educated guesses based on experience. You should timeit or profile your concrete use case to get hard numbers, and those numbers may occasionally disagree with the below. A list comprehension is usually a tiny bit faster than the precisely equivalent for loop (that actually builds a list), most likely … Read more

How do I improve ASP.NET MVC application performance?

A compiled list of possible sources of improvement are below: General Make use of a profiler to discover memory leaks and performance problems in your application. personally I suggest dotTrace Run your site in Release mode, not Debug mode, when in production, and also during performance profiling. Release mode is much faster. Debug mode can … Read more

Why use AJAX when WebSockets is available?

WebSockets isn’t intended to replace AJAX and is not strictly even a replacement for Comet/long-poll (although there are many cases where this makes sense). The purpose of WebSockets is to provide a low-latency, bi-directional, full-duplex and long-running connection between a browser and server. WebSockets opens up new application domains to browser applications that were not … Read more

How costly is .NET reflection?

In his talk The Performance of Everyday Things, Jeff Richter shows that calling a method by reflection is about 1000 times slower than calling it normally. Jeff’s tip: if you need to call the method multiple times, use reflection once to find it, then assign it to a delegate, and then call the delegate.