Comparing version 0.9.26 to 0.9.27
@@ -16,3 +16,3 @@ #!/usr/bin/env node | ||
const koffi = require('../build/koffi.node'); | ||
const koffi = require('./build/koffi.node'); | ||
@@ -30,10 +30,11 @@ const strings = [ | ||
function main() { | ||
if (process.argv.length < 3) | ||
throw new Error('Missing number of iterations'); | ||
let iterations = 20000000; | ||
let iterations = parseInt(process.argv[2], 10); | ||
if (Number.isNaN(iterations)) | ||
throw new Error('Not a valid number'); | ||
if (iterations < 1) | ||
throw new Error('Value must be positive'); | ||
if (process.argv.length >= 3) { | ||
iterations = parseInt(process.argv[2], 10); | ||
if (Number.isNaN(iterations)) | ||
throw new Error('Not a valid number'); | ||
if (iterations < 1) | ||
throw new Error('Value must be positive'); | ||
} | ||
console.log('Iterations:', iterations); | ||
@@ -40,0 +41,0 @@ |
@@ -29,10 +29,11 @@ #!/usr/bin/env node | ||
function main() { | ||
if (process.argv.length < 3) | ||
throw new Error('Missing number of iterations'); | ||
let iterations = 20000000; | ||
let iterations = parseInt(process.argv[2], 10); | ||
if (Number.isNaN(iterations)) | ||
throw new Error('Not a valid number'); | ||
if (iterations < 1) | ||
throw new Error('Value must be positive'); | ||
if (process.argv.length >= 3) { | ||
iterations = parseInt(process.argv[2], 10); | ||
if (Number.isNaN(iterations)) | ||
throw new Error('Not a valid number'); | ||
if (iterations < 1) | ||
throw new Error('Value must be positive'); | ||
} | ||
console.log('Iterations:', iterations); | ||
@@ -39,0 +40,0 @@ |
@@ -19,3 +19,2 @@ #!/usr/bin/env node | ||
const struct = require('ref-struct-di')(ref); | ||
const path = require('path'); | ||
@@ -33,10 +32,11 @@ const strings = [ | ||
async function main() { | ||
if (process.argv.length < 3) | ||
throw new Error('Missing number of iterations'); | ||
let iterations = 20000000; | ||
let iterations = parseInt(process.argv[2], 10); | ||
if (Number.isNaN(iterations)) | ||
throw new Error('Not a valid number'); | ||
if (iterations < 1) | ||
throw new Error('Value must be positive'); | ||
if (process.argv.length >= 3) { | ||
iterations = parseInt(process.argv[2], 10); | ||
if (Number.isNaN(iterations)) | ||
throw new Error('Not a valid number'); | ||
if (iterations < 1) | ||
throw new Error('Value must be positive'); | ||
} | ||
console.log('Iterations:', iterations); | ||
@@ -43,0 +43,0 @@ |
@@ -21,3 +21,5 @@ # This program is free software: you can redistribute it and/or modify | ||
add_subdirectory(.. koffi) | ||
if(NOT TARGET koffi) | ||
add_subdirectory(.. koffi) | ||
endif() | ||
add_subdirectory(../test test) | ||
@@ -24,0 +26,0 @@ |
@@ -16,3 +16,3 @@ #!/usr/bin/env node | ||
const koffi = require('../build/koffi.node'); | ||
const koffi = require('./build/koffi.node'); | ||
const path = require('path'); | ||
@@ -75,13 +75,14 @@ | ||
function main() { | ||
if (process.argv.length < 3) | ||
throw new Error('Missing number of iterations'); | ||
let iterations = 100; | ||
let iterations = parseInt(process.argv[2], 10); | ||
if (Number.isNaN(iterations)) | ||
throw new Error('Not a valid number'); | ||
if (iterations < 1) | ||
throw new Error('Value must be positive'); | ||
if (process.argv.length >= 3) { | ||
iterations = parseInt(process.argv[2], 10); | ||
if (Number.isNaN(iterations)) | ||
throw new Error('Not a valid number'); | ||
if (iterations < 1) | ||
throw new Error('Value must be positive'); | ||
} | ||
console.log('Iterations:', iterations); | ||
let lib_filename = path.dirname(__filename) + '/../test/build/raylib' + koffi.extension; | ||
let lib_filename = path.dirname(__filename) + '/test/build/raylib' + koffi.extension; | ||
let lib = koffi.load(lib_filename); | ||
@@ -88,0 +89,0 @@ |
@@ -19,3 +19,3 @@ #!/usr/bin/env node | ||
const struct = require('ref-struct-di')(ref); | ||
const koffi = require('../build/koffi.node'); | ||
const koffi = require('./build/koffi.node'); | ||
const path = require('path'); | ||
@@ -91,5 +91,13 @@ | ||
function main() { | ||
if (process.argv.length < 3) | ||
throw new Error('Missing number of iterations'); | ||
let iterations = 100; | ||
if (process.argv.length >= 3) { | ||
iterations = parseInt(process.argv[2], 10); | ||
if (Number.isNaN(iterations)) | ||
throw new Error('Not a valid number'); | ||
if (iterations < 1) | ||
throw new Error('Value must be positive'); | ||
} | ||
console.log('Iterations:', iterations); | ||
let iterations = parseInt(process.argv[2], 10); | ||
@@ -102,3 +110,3 @@ if (Number.isNaN(iterations)) | ||
let lib_filename = path.dirname(__filename) + '/../test/build/raylib' + koffi.extension; | ||
let lib_filename = path.dirname(__filename) + '/test/build/raylib' + koffi.extension; | ||
@@ -105,0 +113,0 @@ const r = ffi.Library(lib_filename, { |
{ | ||
"name": "koffi", | ||
"version": "0.9.26", | ||
"version": "0.9.27", | ||
"description": "Fast and simple FFI (foreign function interface) for Node.js", | ||
@@ -26,3 +26,3 @@ "keywords": [ | ||
"dependencies": { | ||
"cnoke": "^0.9.26" | ||
"cnoke": "^1.0.1" | ||
}, | ||
@@ -29,0 +29,0 @@ "devDependencies": { |
@@ -264,3 +264,3 @@ # Table of contents | ||
Once this is done, you can execute each implementation, e.g. `build/atoi_cc 20000000` or `./atoi_koffi.js 20000000`. | ||
Once this is done, you can execute each implementation, e.g. `build/atoi_cc` or `./atoi_koffi.js`. You can optionally define a custom number of iterations, e.g. `./atoi_koffi.js 10000000`. | ||
@@ -272,13 +272,13 @@ ## atoi results | ||
```sh | ||
$ build/atoi_cc 20000000 | ||
$ build/atoi_cc | ||
Iterations: 20000000 | ||
Time: 0.24s | ||
$ ./atoi_napi.js 20000000 | ||
$ ./atoi_napi.js | ||
Iterations: 20000000 | ||
Time: 1.56s | ||
Time: 1.10s | ||
$ ./atoi_koffi.js 20000000 | ||
$ ./atoi_koffi.js | ||
Iterations: 20000000 | ||
Time: 2.41s | ||
Time: 2.34s | ||
@@ -289,3 +289,3 @@ # Note: the Node-FFI version does a few setTimeout calls to force the GC to run (around 20 | ||
# to Node-FFI performance. | ||
$ ./atoi_node_ffi.js 20000000 | ||
$ ./atoi_node_ffi.js | ||
Iterations: 20000000 | ||
@@ -298,15 +298,15 @@ Time: 640.49s | ||
```sh | ||
$ build\atoi_cc.exe 20000000 | ||
$ build\atoi_cc.exe | ||
Iterations: 20000000 | ||
Time: 0.66s | ||
$ node atoi_napi.js 20000000 | ||
$ node atoi_napi.js | ||
Iterations: 20000000 | ||
Time: 3.52s | ||
Time: 3.23s | ||
$ node atoi_koffi.js 20000000 | ||
$ node atoi_koffi.js | ||
Iterations: 20000000 | ||
Time: 4.81s | ||
$ node atoi_node_ffi.js 20000000 | ||
$ node atoi_node_ffi.js | ||
Iterations: 20000000 | ||
@@ -321,11 +321,11 @@ Time: 491.99s | ||
```sh | ||
$ build/raylib_cc 100 | ||
$ build/raylib_cc | ||
Iterations: 100 | ||
Time: 4.14s | ||
$ ./raylib_koffi.js 100 | ||
$ ./raylib_koffi.js | ||
Iterations: 100 | ||
Time: 6.25s | ||
$ ./raylib_node_ffi.js 100 | ||
$ ./raylib_node_ffi.js | ||
Iterations: 100 | ||
@@ -338,13 +338,13 @@ Time: 27.13s | ||
```sh | ||
$ build\raylib_cc.exe 100 | ||
$ build\raylib_cc.exe | ||
Iterations: 100 | ||
Time: 10.53s | ||
$ node raylib_koffi.js 100 | ||
$ node raylib_koffi.js | ||
Iterations: 100 | ||
Time: 14.60s | ||
$ node raylib_node_ffi.js 100 | ||
$ node raylib_node_ffi.js | ||
Iterations: 100 | ||
Time: 44.97s | ||
``` |
@@ -17,2 +17,6 @@ # This program is free software: you can redistribute it and/or modify | ||
if(NOT TARGET koffi) | ||
add_subdirectory(.. koffi) | ||
endif() | ||
# ---- Raylib ---- | ||
@@ -19,0 +23,0 @@ |
@@ -28,5 +28,3 @@ { | ||
"build": { | ||
"Install": "npm install --production --ignore-scripts", | ||
"Build Koffi": "node ../cnoke/cnoke.js", | ||
"Build dependencies": "node ../cnoke/cnoke.js -C test" | ||
"Build": "node ../cnoke/cnoke.js -C test" | ||
}, | ||
@@ -68,5 +66,3 @@ "commands": { | ||
"build": { | ||
"Install": "npm install --production --ignore-scripts", | ||
"Build Koffi": "node ../cnoke/cnoke.js", | ||
"Build dependencies": "node ../cnoke/cnoke.js -C test" | ||
"Build": "node ../cnoke/cnoke.js -C test" | ||
}, | ||
@@ -108,5 +104,3 @@ "commands": { | ||
"build": { | ||
"Install": "npm install --production --ignore-scripts", | ||
"Build Koffi": "node ../cnoke/cnoke.js", | ||
"Build dependencies": "node ../cnoke/cnoke.js -C test" | ||
"Build": "node ../cnoke/cnoke.js -C test" | ||
}, | ||
@@ -148,5 +142,3 @@ "commands": { | ||
"build": { | ||
"Install": "npm install --production --ignore-scripts", | ||
"Build Koffi": "node ../cnoke/cnoke.js", | ||
"Build dependencies": "node ../cnoke/cnoke.js -C test" | ||
"Build": "node ../cnoke/cnoke.js -C test" | ||
}, | ||
@@ -188,5 +180,3 @@ "commands": { | ||
"build": { | ||
"Install": "C:\\Node32\\node32.cmd npm install --production --ignore-scripts", | ||
"Build Koffi": "C:\\Node32\\node32.cmd node ../cnoke/cnoke.js", | ||
"Build dependencies": "C:\\Node32\\node32.cmd node ../cnoke/cnoke.js -C test" | ||
"Build": "C:\\Node32\\node32.cmd node ../cnoke/cnoke.js -C test" | ||
}, | ||
@@ -203,5 +193,3 @@ "commands": { | ||
"build": { | ||
"Install": "C:\\Node64\\node64.cmd npm install --production --ignore-scripts", | ||
"Build Koffi": "C:\\Node64\\node64.cmd node ../cnoke/cnoke.js", | ||
"Build dependencies": "C:\\Node64\\node64.cmd node ../cnoke/cnoke.js -C test" | ||
"Build": "C:\\Node64\\node64.cmd node ../cnoke/cnoke.js -C test" | ||
}, | ||
@@ -243,5 +231,3 @@ "commands": { | ||
"build": { | ||
"Install": "npm install --production --ignore-scripts", | ||
"Build Koffi": "node ../cnoke/cnoke.js", | ||
"Build dependencies": "node ../cnoke/cnoke.js -C test" | ||
"Build": "node ../cnoke/cnoke.js -C test" | ||
}, | ||
@@ -283,5 +269,3 @@ "commands": { | ||
"build": { | ||
"Install": "npm install --production --ignore-scripts", | ||
"Build Koffi": "node ../cnoke/cnoke.js", | ||
"Build dependencies": "node ../cnoke/cnoke.js -C test" | ||
"Build": "node ../cnoke/cnoke.js -C test" | ||
}, | ||
@@ -323,5 +307,3 @@ "commands": { | ||
"build": { | ||
"Install": "npm install --production --ignore-scripts", | ||
"Build Koffi": "node ../cnoke/cnoke.js", | ||
"Build dependencies": "node ../cnoke/cnoke.js -C test" | ||
"Build": "node ../cnoke/cnoke.js -C test" | ||
}, | ||
@@ -363,5 +345,3 @@ "commands": { | ||
"build": { | ||
"Install": "PATH=/usr/local/bin:/usr/bin:/bin npm install --production --ignore-scripts", | ||
"Build Koffi": "PATH=/usr/local/bin:/usr/bin:/bin SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk node ../cnoke/cnoke.js", | ||
"Build dependencies": "PATH=/usr/local/bin:/usr/bin:/bin SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk node ../cnoke/cnoke.js -C test" | ||
"Build": "PATH=/usr/local/bin:/usr/bin:/bin SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk node ../cnoke/cnoke.js -C test" | ||
}, | ||
@@ -368,0 +348,0 @@ "commands": { |
@@ -16,3 +16,3 @@ #!/usr/bin/env node | ||
const koffi = require('../../build/koffi.node'); | ||
const koffi = require('../build/koffi.node'); | ||
const assert = require('assert'); | ||
@@ -19,0 +19,0 @@ const path = require('path'); |
@@ -16,3 +16,3 @@ #!/usr/bin/env node | ||
const koffi = require('../../build/koffi.node'); | ||
const koffi = require('../build/koffi.node'); | ||
const crypto = require('crypto'); | ||
@@ -19,0 +19,0 @@ const fs = require('fs'); |
@@ -17,3 +17,3 @@ #!/usr/bin/env node | ||
const crypto = require('crypto'); | ||
const koffi = require('../../build/koffi.node'); | ||
const koffi = require('../build/koffi.node'); | ||
const assert = require('assert'); | ||
@@ -20,0 +20,0 @@ const fs = require('fs'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
39
67722922
1092
12939
Updatedcnoke@^1.0.1