Need some help figuring out performance difference

Hi everyone,

I found out something interesting about the codebase that I work on at my day job. I tried compiling this code on my desktop at home and found out my desktop is way faster than my work laptop. However, looking at the hardware, or mostly the CPU, of both systems, I wouldn’t expect this difference. Here are the numbers:

command work home
mvn clean compile 40s 13s
mvn clean package -DskipTests 1m 6s 24s
mvn clean package 4m 57s 3m 11s
java - version Java™ SE Runtime Environment (build 1.8.0_221-b11) OpenJDK Runtime Environment (build 1.8.0_232-b09)
mvn -version Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T20:33:14+02:00) Apache Maven 3.6.3 (NON-CANONICAL_2019-11-27T20:26:29Z_root)
OS Windows 10 Linux

For the non-java developers, mvn clean compile is basically just compiling the code, mvn clean package -DskipTests builds the executable and mvn clean package builds the executable and runs all the tests.

As for the hardware, I have an i5 4690 with 16Gb of DDR3 memory (I think the speed is 1600MHz).

My work laptop has a E3-1535M v5 with 32Gb of memory. I don’t know the speed of that memory though.

Both systems run SSD hard drives.

So my question is mostly where the performance difference could come from. I feel like the difference between the processors should not make this big of a difference, but perhaps I’m wrong. Could someone tell me where to look next?

EDIT: on the work laptop I disabled Kaspersky and excluded the project directory from windows defender. Those are the only anti-virus scanners as far as I know. (I really hope they didn’t cram more on there…)

My money is on the way Linux makes system calls and the fact that you’re using openjdk, consider isntalling the same JDK and try again.

And also thermal throttling might be an issue, your desktop processor is always running at base-clock at least while the laptop might be struggling.

Check resource usage on work laptop to see the frequency of the CPU and come back to us (also try the proprietary JDK)

And tell us your distro btw… Linux is too vague

You’re comparing a 45w CPU to a 84w CPU.

The i5 is going to turbo way better than the Xeon, and maintain that speed for longer.

That’s part of it. You’re probably also running lower speed memory on the laptop, and you might also have a slower SSD on the laptop, and windows system calls are less efficient than Linux.

I think your major component is going to be the CPU difference, and that’ll make up 70% of the difference you’re seeing. The other 30% is a combination of the other factors I mentioned above.

6 Likes

A big difference is the Linux filesystems are so much better. It’s amazing how slow NTFS has become. Really.

Try doing a git operation in a Windows working directory. Compared to Linux it can take five times longer! Even when the entire directory should be cached in RAM.

1 Like

Thanks guys! It got quite busy at work so I won’t have time to test further right now. I might post an update in a few days, I’ll try the following:

  • Benchmark the SSD speeds
  • Try putting the code in a ramdisk so the SSD is ignored altogether
  • I’ll monitor the reported clock speeds of the CPU while compiling the code

P.S. @SgtAwesomesauce, I checked the memory speed on the laptop with wmic memorychip get speed. It reports 2400MHz.

Laptop vs. desktop? Desktop CPUs boost harder for longer and generally have more cache.

All SSDs are not the same also.

@SgtAwesomesauce is on the money.

Whilst the on paper turbo speeds (in terms of turbo Mhz) of the two CPUs may be similar, there’s no escaping the fact that laptop CPUs are different (less cache, etc.), don’t turbo for as long, thermal throttle more (limited cooling), power throttle more (lower TDP), etc.

Seriously, whilst they may both be quad cores with similar boost, the TDP on the mobile part will kill performance while the desktop part keeps trucking.

i.e., the mobile part can turbo individual cores for a short period of time. The desktop part can turbo more than one or two cores for far longer, and maintain higher clocks indefinitely.

Take this from someone who tried “desktop replacement” notebooks for VM lab work for 5 years or so. Desktop replacement = BALLS. They’re good for a portable, but vs. even a 2-5 year older desktop with similar core count, they suck.

1 Like

My desktop i5-4670 will often beat out my i7-7700HQ laptop. Nominally the laptop CPU is newer, with higher or as high turbo speeds and more cache. The desktop CPU can be set to permanently turbo boost and will stay there. The laptop chip - no chance.

I suspect the fixes for side-channel attacks also impacted hyper-threaded CPU performance to a greater extent as well. This is born out in geekbench - you would expect the 8 thread laptop CPU to at least beat the 4 thread desktop CPU in multi-threaded operations. It does, but barely. One problem with hyper-threading is that it can raise CPU temps which isn’t good for a laptop CPU.

Windows always scores lower in geekbench, I’ve never investigated why that is, but probably shouldn’t read too much into it.

2 Likes

Over the past 2 decades of working and using a variety of form factor laptops… I’ve come to the conclusion that high end laptops are 99.9% a waste of time. Especially now ultrabooks and tablets exist.

Get a tablet/ultraportable notebook for away from the desk, and a proper desktop for the heavy lifting.

You can’t generally do heavy work on a notebook away from a desk anyway, as the battery life will be about 15-45 minutes when working hard on battery :smiley:

They suck to travel with, don’t fit on aircraft tray tables, etc.

If you need a machine to lug from desk to desk that has power… that’s about the only use case for a high end “desktop replacement” laptop in my opinion. If that’s not what you do… spend less money on a desktop and a tablet (for the email/web/away from desktop stuff) :smiley:

1 Like

I did some more testing guys, I tried the following things:

Inspired by @BGL, I used Geekbench v5 to compare the CPU of the two systems. Their scores are way closer than I expected though. There is a gap between the two, but it’s nowhere near the gap in the compile times. The multithreading score for the mobile CPU is way higher, probably because of SMT.

Despite this, would you still think the main difference would be because of the CPU @SgtAwesomesauce? Perhaps the benchmark gives a skewed result for some reason?

With the CPU probably not being the problem, I tried installing an OpenJDK distribution. This shaved a few seconds off the mvn clean package -DskipTests command, bringing it to 58-60 seconds.

The lastly I played around with some Ram disks. I created a FAT, FAT32 and NTFS ramdisk, of which the NTFS ramdisk performed the best. Combined with the new OpenJDK, the best compile time I got was around 44 seconds (still for mvn clean install -DskipTests). So I gained about 20 seconds in total.

The weird thing is that my other machine is still 50% faster. I would think that with a ramdisk, it’s mostly the CPU that makes the difference. But the geekbench scores suggest that the CPUs are pretty much on par for single-threaded performance, but the laptop’s CPU is quite a bit better with multithreaded workloads.

I didn’t monitor the CPU frequencies, but I think that if there were any issues there they would show up in the Geekbench score.

Does anyone have any other clues for what might be the issue here?

EDIT: added geekbench screenshot

Any chance you can boot into a Linux environment on the ZBook via USB and test from that? Both Geekbench and your compile test? You need to try and make things as equal as possible - Windows could be doing something funky; I’ve seen a few things run better in a Linux VM under Hyper-V than on the host Windows OS thanks to better scheduling.

That’s a good idea! Hopefully I’ll have time to test that on Thursday.
I’ll let you know :slight_smile:

I keep the same first answers: boost clocks better sustained on desktop and linux syscalls