Long vs long in Java

Revision en2, by safarisoul, 2016-01-14 07:38:38

Intuitively, long as primitive type should be faster in case of multiplication or other arithmetic operations than Long as object type. However, my recent submissions to a CF problem 439B - Devu, the Dumb Guy disproved this intuition.

15307785 using long, the primitive type got TLE, whilst 15307798 using Long, the object type got Accepted, and has a large timely improvement over the previous one by like 10 times.

Does anyone have any idea why this happened?

Tags java, sort

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English safarisoul 2016-01-21 14:05:14 73 Tiny change: ' happened?' -> ' happened?\n\nHere is another problem :[problem:285C]'
en2 English safarisoul 2016-01-14 07:38:38 10
en1 English safarisoul 2016-01-14 07:36:01 508 Initial revision (published)