Câu hỏi phỏng vấn Node.js
Câu hỏi

Làm thế nào để đo thời gian của các ...

Câu trả lời

API Performance cung cấp cho chúng ta các công cụ để tìm ra các chỉ số hiệu suất cần thiết. Một ví dụ đơn giản sẽ là sử dụng async_hooksperf_hooks

js Copy
'use strict';
const async_hooks = require('async_hooks');
const {
    performance,
    PerformanceObserver
} = require('perf_hooks');
const set = new Set();
const hook = async_hooks.createHook({
    init(id, type) {
        if (type === 'Timeout') {
            performance.mark(`Timeout-${id}-Init`);
            set.add(id);
        }
    },
    destroy(id) {
    if (set.has(id)) {
        set.delete(id...
senior

senior

Gợi ý câu hỏi phỏng vấn

middle

API bất đồng bộ trong Nodejs là gì?

junior

Middleware trong Nodejs là gì?

middle

Blocking Code trong Node.js là gì?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào