This file contains hidden or 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
Machine | Mac Book Pro | Hp | Virtual Machine | |
---|---|---|---|---|
Processor | 2.2GHz Intel i7 | Intel(R)Core(TM)[email protected] | Intel(R)Xeon(R)CPU [email protected] | |
CPU Count | 8 | 8 | 2 | |
Operating System | macOS Sierra | Windows 10 Pro | Ubuntu 16.04 LTS(xenial) | |
Node | 10.0.1 | 9.6.1 | 8.11.2 | |
t | t | t | t | |
Classical For | 16.278 | 134.288 | 34.912 | |
For Length defined | 15.44 | 151.212 | 27.813 | |
Reverse For | 15.278 | 132.534 | 28.005 | |
Reverse While | 14.757 | 116.211 | 20.628 |
This file contains hidden or 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
Machine | Mac Book Pro | Hp | Virtual Machine | |
---|---|---|---|---|
Processor | 2.2GHz Intel i7 | Intel(R)Core(TM)[email protected] | Intel(R)Xeon(R)CPU [email protected] | |
CPU Count | 8 | 8 | 2 | |
Operating System | macOS Sierra | Windows 10 Pro | Ubuntu 16.04 LTS(xenial) | |
Node | 10.0.1 | 9.6.1 | 8.11.2 | |
t | t | t | t | |
Classical For | 113.897 | 293.612 | 184.597 | |
For Length defined | 109.186 | 227.223 | 161.769 | |
Reverse For | 106.299 | 497.724 | 179.925 | |
Reverse While | 110.679 | 208.435 | 171.540 |
This file contains hidden or 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
import http from 'http'; | |
import morgan from 'morgan'; | |
import express from 'express'; | |
import bodyParser from 'body-parser'; | |
import cluster from 'cluster'; | |
import { setRouter } from './route'; | |
const app = express(); | |
let workers = []; |
This file contains hidden or 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
export default class AsyncListController { | |
createList = async(req, res) => { | |
await this.populateHugeList(); | |
res.json({ ProcessId: 'Worker Process Id' + process.pid }); | |
}; | |
/* populate list with million elements | |
*/ | |
populateHugeList = async() => { |
This file contains hidden or 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
// module included to create worker threads | |
const { Worker } = require('worker_threads'); | |
// main attributes | |
let lst; // list will be populated from 0 to n | |
let index = -1; // index will be used to traverse list | |
let myWorker; // worker reference | |
let interval; | |
mainBody(); |
This file contains hidden or 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
// parentPort for registering to events from main thread | |
// workerData for receiving data clone | |
const { parentPort, workerData } = require('worker_threads'); | |
let interval; | |
let index = -1; | |
registerForEventListening(); | |
function registerForEventListening () { |
This file contains hidden or 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
module.exports = { | |
apps : [ | |
{ | |
name : 'Custering', | |
script : 'Clustering/src/app.babel-register.js', | |
exec_mode : 'cluster_mode', | |
instances : 'max' | |
}, | |
{ | |
name : 'Clustering_Replcia', |
This file contains hidden or 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 { Router } = require('express'); | |
const express_graphql = require('express-graphql'); | |
const { buildSchema } = require('graphql'); | |
const studentController = require('./student.ctrl'); | |
// GraphQL schema | |
const schema = buildSchema(` | |
scalar Date | |
, input SearchInput { |
This file contains hidden or 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
query getStudent($studentId: String, $firstName: String) { | |
byId: findOne(input: {_id: $studentId}) { | |
...studentFields | |
} | |
byName: findOne(input: {firstName: $firstName}) { | |
...studentFields | |
} | |
} | |
mutation createStudent($firstName: String!, $lastName: String!, $registrationNumber: Int!, $email: String!) { |
This file contains hidden or 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
{ | |
"studentId": "5e727fa7b9f23a1c643e671f", | |
"firstName": "Danish", | |
"lastName": "Siddiq", | |
"registrationNumber": 543678, | |
"email": "[email protected]" | |
} | |
OlderNewer