Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance on i5 better then on latest i9 #1457

Closed
golojads opened this issue Nov 14, 2018 · 7 comments
Closed

Performance on i5 better then on latest i9 #1457

golojads opened this issue Nov 14, 2018 · 7 comments
Labels

Comments

@golojads
Copy link

I have very basic test and very strange results.

console.time("ROTATE-RESIZE")
sharp('./photo.JPG')
  .rotate(90)
  .resize(200)
  .toBuffer()
    .then(()=> {
      console.timeEnd("ROTATE-RESIZE")
    })

On Macbook Pro Mojave ( Core i5-7267U, 8RAM, Iris VGA) execution time is ~93ms
While on Desktop Ubuntu 18.4 (Core i9-7944X, 16Ram , M2 SSD, Geforce 1050) execution time is ~121ms

I bought this monster PC to speed up resizing, but in reality I got 20% performance decrease.
Do you have any explanation ?

Thank you.

@golojads
Copy link
Author

Both running Node v10.13

@golojads
Copy link
Author

test/bench/parallel.js results

Macbook:

1 parallel calls: fastest=59ms slowest=59ms mean=59ms
1 parallel calls: fastest=20ms slowest=20ms mean=20ms
{ queue: 0, process: 2 }
2 parallel calls: fastest=32ms slowest=33ms mean=32.5ms
4 parallel calls: fastest=50ms slowest=52ms mean=51.5ms
{ queue: 0, process: 8 }
8 parallel calls: fastest=103ms slowest=96ms mean=91.125ms
{ queue: 0, process: 16 }
{ queue: 0, process: 13 }
16 parallel calls: fastest=118ms slowest=191ms mean=164.625ms
{ queue: 0, process: 32 }
{ queue: 0, process: 32 }
{ queue: 0, process: 22 }
32 parallel calls: fastest=230ms slowest=401ms mean=337.90625ms
{ queue: 4, process: 60 }
{ queue: 0, process: 64 }
{ queue: 0, process: 63 }
{ queue: 0, process: 51 }
{ queue: 0, process: 45 }
{ queue: 0, process: 26 }
64 parallel calls: fastest=192ms slowest=820ms mean=674.359375ms
{ queue: 0, process: 0 }

Ubuntu

1 parallel calls: fastest=56ms slowest=56ms mean=56ms
1 parallel calls: fastest=27ms slowest=27ms mean=27ms
{ queue: 0, process: 2 }
2 parallel calls: fastest=31ms slowest=42ms mean=36.5ms
4 parallel calls: fastest=33ms slowest=42ms mean=37.25ms
{ queue: 0, process: 8 }
8 parallel calls: fastest=40ms slowest=49ms mean=44.125ms
16 parallel calls: fastest=56ms slowest=71ms mean=63.8125ms
{ queue: 0, process: 32 }
{ queue: 0, process: 32 }
32 parallel calls: fastest=127ms slowest=159ms mean=148.40625ms
{ queue: 0, process: 64 }
{ queue: 0, process: 64 }
{ queue: 0, process: 64 }
64 parallel calls: fastest=259ms slowest=313ms mean=304.3125ms
{ queue: 0, process: 0 }

@lovell
Copy link
Owner

lovell commented Nov 15, 2018

Hello, is this using the latest sharp? Are the prebuilt libvips binaries being used or could vips have been compiled/installed globally? If globally, were the same compiler flags used?

Are you able to run the full set of benchmark tests on each? http://sharp.pixelplumbing.com/en/stable/performance/#running-the-benchmark-test

The newer CPU has a higher clock speed, more cores and a larger CPU cache so I'd expect it to be a bit faster, although you may be approaching the I/O limits of libjpeg.

@golojads
Copy link
Author

is this using the latest sharp?

  • YES v0.21

Are the prebuilt libvips binaries ...?

  • I simply installed latest sharp on both machines. I did not compile/install manually any libraries ( libvips , vips ). Just "npm install sharp"

Are you able to run the full set of benchmark tests on each?

No it is failing on both machines here -> "cd test/bench > npm install" with

npm ERR! imagemagick-native@1.9.3 install: `node-gyp rebuild` npm ERR! Exit status 1

test/bench/parallel.js is the only test I can run

approaching the I/O limits

I'm using this SSD -> Samsung 970 Pro SSD review: The fastest M.2 NVMe drive yet

@lovell
Copy link
Owner

lovell commented Nov 15, 2018

There are a few prerequisites that need to be installed for the benchmark test dependencies to compile correctly.

http://sharp.pixelplumbing.com/en/stable/performance/#benchmark-test-prerequisites

I should probably create a Docker image to make these easier to run.

@golojads
Copy link
Author

False alarm. One file processing make no sense.
Once I run it on 590 different files, each applied unique set of modifications( scale, rotate, combine, extend, extract) - the result on Ubuntu machine was 4.1 times faster. ( 6.81min vs 1.66min)

More than happy.

Thank you for assistance and the package itself.
Do you have donations wallet for "Sharp" ?

@lovell
Copy link
Owner

lovell commented Nov 15, 2018

Glad you worked it out. If you'd like to donate something, please do so to a homelessness charity local to you.

@lovell lovell closed this as completed Nov 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants