Skip to content

Commit 61c45c2

Browse files
committed
add node bench
1 parent cb4bc8e commit 61c45c2

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

benchmark.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ echo "program, time (s), peak memory (MB)"
8989

9090
benchmark tiffcp "tiffcp -s $tmp/x.tif $tmp/x2.tif"
9191

92+
benchmark pyvips2.py "./pyvips2.py $tmp/x.tif $tmp/x2.tif"
93+
94+
benchmark vips.js "./vips.js $tmp/x.tif $tmp/x2.tif"
95+
96+
benchmark vips8.py "./vips8.py $tmp/x.tif $tmp/x2.tif"
97+
9298
gcc -Wall vips.c `pkg-config vips --cflags --libs` -o vips-c
9399
benchmark vips-c "./vips-c $tmp/x.tif $tmp/x2.tif"
94100

pyvips2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
im = im.similarity(scale = 0.9,
1010
interpolate = pyvips.Interpolate.new("bilinear"))
1111
mask = pyvips.Image.new_from_array([[-1, -1, -1],
12-
[-1, 16, -1],
13-
[-1, -1, -1]], scale = 8)
12+
[-1, 16, -1],
13+
[-1, -1, -1]], scale = 8)
1414
im = im.conv(mask, precision = "integer")
1515

1616
im.write_to_file(sys.argv[2])

vips.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env node
2+
3+
var vips = require('../node-vips');
4+
5+
image = vips.Image.new_from_file(process.argv[2]);
6+
image = image.crop(100, 100, image.width - 200, image.height - 200);
7+
8+
image = image.reduce(1.0 / 0.9, 1.0 / 0.9, {kernel: 'linear'});
9+
10+
mask = vips.Image.new_from_array(
11+
[[-1, -1, -1],
12+
[-1, 16, -1],
13+
[-1, -1, -1]], 8);
14+
image = image.conv(mask, {precision: 'integer'});
15+
16+
image.write_to_file(process.argv[3]);

0 commit comments

Comments
 (0)