Skip to content

Tag: performance

Moving character efficiently on a row

Given input (items = 6, position = 3) creates a row of 6 items and a character positioned on item 3 {0,1,2,[3],4,5} A call to left() moves the character two positions to the left and the item at position 3 is removed {0,[1],2,4,5} The next call to right() moves the character two positions to the right and the item at

Does the use of Spring Webflux’s WebClient in a blocking application design cause a larger use of resources than RestTemplate

I am working on several spring-boot applications which have the traditional pattern of thread-per-request. We are using Spring-boot-webflux to acquire WebClient to perform our RESTful integration between the applications. Hence our application design requires that we block the publisher right after receiving a response. Recently, we’ve been discussing whether we are unnecessarily spending resources using a reactive module in our

How to solve this java problem efficiently [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 months ago. Improve this question I am trying to solve this problem and I worked out a solution but its too slow, this is my approach: loop to add all

Java Quick Sort Performance

I was doing sorting array problems and found one of the quick sorting solution extremely fast, and the only difference is the two lines of code in function 1Partition. Wondering why the following two lines of code in 1Partition can greatly improve the performance: Here’s the full source code: } Answer I guess you are doing the question on a

Split by regex vs multiple one char splits performance

I compared splitting string by regex and by multiple one char splits, using this benchmark and got these results Why splitting by regex is slower than splitting by multiple individual characters, even though they produce the same result? Note: I ran the code on JDK 14.0.2 I used JMH 1.28 Answer String.split implementation has the optimized fast path for splitting