This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('start'); | |
const fs = require('fs'); | |
const data = fs.readFileSync('test.txt'); | |
console.log('end'); | |
# output | |
# ------- | |
# start | |
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('start'); | |
const fs = require('fs'); | |
var data = ''; | |
fs.readFile('test.txt', (err, result) => { | |
if (err) { | |
throw err; | |
} else { | |
console.log('complete now') | |
data = result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 시작은 main 함수! | |
// src/node_main.cc : 94 | |
int main(int argc, char* argv[]) { | |
return node::Start(argc, argv); | |
} | |
// src/node.cc : 3036 | |
int Start(int argc, char** argv) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/node_main.cc : 94 | |
int main(int argc, char* argv[]) { | |
~~~ | |
return node::Start(argc, argv); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// loader.js를 실행하고 나서, node.js를 실행하는데, node.js안에서는 이렇게 함수가 호출되어있다. | |
// 즉, loader.js에서 load에 필요한 함수들을 정의한 뒤에, node.js에서 그걸 사용하면서 실제로 load를 진행한다. | |
startup(); | |
// lib/internal/bootstrap/node.js : 31 | |
function startup() { | |
// Make process.argv[1] into a full path. | |
const path = NativeModule.require('path'); | |
process.argv[1] = path.resolve(process.argv[1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const start = Date.now(); | |
crypto.pbkdf2( 'a', 'b', 100000, 512, 'sha512', () => { | |
console.log( '1:', Date.now() - start ); | |
}); | |
// output | |
// 1: 1036 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const start = Date.now(); | |
crypto.pbkdf2( 'a', 'b', 100000, 512, 'sha512', () => { | |
console.log( '1:', Date.now() - start ); | |
}); | |
crypto.pbkdf2( 'a', 'b', 100000, 512, 'sha512', () => { | |
console.log( '2:', Date.now() - start ); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const start = Date.now(); | |
crypto.pbkdf2( 'a', 'b', 100000, 512, 'sha512', () => { | |
console.log( '1:', Date.now() - start ); | |
}); | |
crypto.pbkdf2( 'a', 'b', 100000, 512, 'sha512', () => { | |
console.log( '2:', Date.now() - start ); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const start = Date.now(); | |
crypto.pbkdf2( 'a', 'b', 100000, 512, 'sha512', () => { | |
console.log( '1:', Date.now() - start ); | |
}); | |
crypto.pbkdf2( 'a', 'b', 100000, 512, 'sha512', () => { | |
console.log( '2:', Date.now() - start ); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.env.UV_THREADPOOL_SIZE = 2; | |
const crypto = require('crypto'); | |
const start = Date.now(); | |
crypto.pbkdf2( 'a', 'b', 100000, 512, 'sha512', () => { | |
console.log( '1:', Date.now() - start ); | |
}); | |
crypto.pbkdf2( 'a', 'b', 100000, 512, 'sha512', () => { |
OlderNewer