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
package main | |
import ( | |
"github.com/gofiber/fiber/v2" | |
) | |
func main() { | |
app := fiber.New() | |
app.Get("/ping", func(c *fiber.Ctx) error { |
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
package main | |
import ( | |
"github.com/gofiber/fiber/v2" | |
) | |
func main() { | |
app := fiber.New() | |
app.Get("/ping", func(c *fiber.Ctx) error { |
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
package main | |
import ( | |
"github.com/gofiber/fiber/v2" | |
) | |
func main() { | |
app := fiber.New() | |
app.Get("/ping", func(c *fiber.Ctx) error { |
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 express = require("express"); | |
const app = express(); | |
app.get("/ping", (req, res) => res.send("pong")); | |
app.listen(3000, () => console.log("Node.js listening on 3000")); |
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
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
) | |
func fakeWork(wg *sync.WaitGroup, id int) { | |
defer wg.Done() |
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 wait = ms => new Promise(resolve => setTimeout(resolve, ms)); | |
async function fakeWork() { | |
await wait(100); | |
} | |
(async () => { | |
console.time("Node Concurrency"); | |
await Promise.all(Array.from({ length: 10 }, fakeWork)); | |
console.timeEnd("Node Concurrency"); |
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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
start := time.Now() |
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
console.time("Node Loop Benchmark"); | |
import Long from "long"; | |
let sum = Long.ZERO; | |
for (let i = 0; i < 1_000_000_000; i++) { | |
sum = sum.add(Long.fromInt(i)); // more efficient for small values | |
} | |
console.log("Sum:", sum.toString()); | |
console.timeEnd("Node Loop Benchmark"); |
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
console.time("Node Loop Benchmark"); | |
let sum = 0n; | |
for (let i = 0n; i < 1_000_000_000n; i++) { | |
sum += i; | |
} | |
console.timeEnd("Node Loop Benchmark"); | |
console.log("Sum:", sum.toString()); |
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
console.time("Node Loop Benchmark"); | |
let sum = 0; | |
for (let i = 0; i < 1_000_000_000; i++) { | |
sum += i; | |
} | |
console.timeEnd("Node Loop Benchmark"); | |
console.log("Sum:", sum); |
NewerOlder