performance
13 tutorials tagged “performance”.
- Buffered Streams in JavaBuffered streams cut disk access by reading and writing in large blocks. Learn BufferedReader, BufferedWriter and friends, and measure the speed-up.
- Time Complexity of Collection OperationsBig O costs of add, get, remove and contains for ArrayList, LinkedList, HashSet, TreeSet, HashMap, TreeMap, PriorityQueue and ArrayDeque in one place.
- False Sharing and @ContendedFalse sharing slows threads that update different variables on the same CPU cache line. Learn about cache lines, measuring the effect, and padding.
- JIT Optimizations in JavaC2 speeds up hot code with inlining, escape analysis, loop unrolling and speculation, and deoptimizes when assumptions break. See two of them measured.
- Benchmarking with JMHTiming Java code with System.nanoTime misleads. Write reliable microbenchmarks with JMH: warmup, forks, @State, @Param, Blackhole and reading results.
- Lazy Evaluation and Short-Circuiting in StreamsStreams process elements one at a time, only when needed, and can stop early. See the real order of operations, why infinite streams work, and the costs.
- Memory-Mapped Files in JavaMemory-mapped files let a program read and write a file as if it were memory, using FileChannel.map and MappedByteBuffer. Learn how and when to use them.
- Parallel Streams in JavaParallel streams split work across CPU cores using the common ForkJoinPool. Learn how they work, when they help, and when they are slower or wrong.
- Primitive Functional Interfaces in JavaIntPredicate, IntFunction, ToIntFunction, IntUnaryOperator and friends avoid boxing when lambdas work with int, long and double. Learn them with examples.
- Primitive Streams in JavaIntStream, LongStream and DoubleStream work with numbers directly and add sum, average, max, range and summaryStatistics. Learn how and when to use them.