Skip to content

Instantly share code, notes, and snippets.

View Mutefish0's full-sized avatar

Ivancing Mutefish0

  • Beijing
View GitHub Profile
@Mutefish0
Mutefish0 / class_vs_function_entity.js
Created December 4, 2024 03:06
Class vs Function_Entity
// 类模式
class MyClass {
constructor(a, b) {
this.a = a;
this.b = b;
this.result = 0;
}
calculate() {
this.result = this.a + this.b;
}
@Mutefish0
Mutefish0 / async_generator_perf.js
Last active October 31, 2023 09:56
Async Generator Performance
const C = 20_000_000;
async function* AG() {
const ret = [];
for (let i = 0; i < C; i++) {
ret.push(i);
}
for (const item of ret) {
yield item;
}