Curious about the future of data-driven systems? Join our Data Engineering roundtable and learn how to build scalable data platforms.
Data Engineering: The industry has come a long way from organizing unstructured data to adopting today's modern data pipelines. See how.
Java architect and performance optimization at Kyanon Digital
Hanoi, VN
Joined Nov 2014
Stats
| Reputation: | 694 |
| Pageviews: | 149.4K |
| Articles: | 4 |
| Comments: | 10 |
Comments
Sep 04, 2019 · Dang Ngoc Vu
Hi Trevor,
JMH guaranty that Blackhole.consume() doesn't impact to the benchmark result. JVM can detect and remove block of code that don't modify anythings nor don't impact to any Object. That why JMH provide Blackhole utility. Unfortunely, BenchmarkDotNet doesn't have the similar feature.
I try to modify benchmark code of C# as below but the benchmark result still the same. I agree with you that we need to check IL code to make sure what's going on but it's out of my ability, I need to study more about this topic.
[Benchmark]
public int Loop()
{
int result = 0;
for (int i = 0; i < N; i++)
{
result = data[i].x ^ data[i].y;
}
return result;
}
Feb 12, 2019 · Tarun Telang
My company have a product with more than 100 customers, there is a List that can contains from 3 to 100k items. If I set initial size too small, then there are overheat of reallocate the array. If I set initial size too big, then we waste a lot of memory with case of 3 items. LinkedList is more suitable in this case.
Feb 11, 2019 · Tarun Telang
I got your point, but I had a performance issue when using ArrayList and cannot predict size of items, then I changed to LinkedList and it worked perfectly.
Feb 11, 2019 · Tarun Telang
each time an array is fulled, JVM will move the array to a new region of memory with size of 1,5*old_size. If you need few more slots but JVM still allocate big memory, then you will encounter a memory waste.
Feb 07, 2019 · Tarun Telang
when you cannot assume the size of array, LinkedList is more memory effective.
Oct 10, 2018 · Ioan Tinca
Java 9 has Flow API and LMAX Disruptor is mature since very long time, but I don't know "Java blockchain"
Jul 15, 2018 · Dang Ngoc Vu
Thank you for your comment! I try with
public List<Integer> streamMultiThreadWithCollect(BenchMarkState state){
List<Integer> result = state.testData.stream().parallel()
.collect(Collectors.toCollection(ArrayList::new));
return result;
}
The result is better, with 50ms/op with the same condition.
Jul 06, 2018 · Dang Ngoc Vu
Thank you for your comment, I've just updated source code and benchmark results
May 24, 2018 · Dang Ngoc Vu
Thank you for your comments, I'll update benchmark code and run again
Jan 02, 2017 · A N M Bazlur Rahman
Also run at differrent env, parallel stream run slower at single core or old CPUs, but faster than serrial stream at multi cores CPUs