kevent with timeout = 0
rate 80986.22 nanos_op 12347
rate 81772.37 nanos_op 12229
rate 81650.72 nanos_op 12247
rate 81608.60 nanos_op 12253
rate 81304.12 nanos_op 12299
kevent64 with timeout = 0 and flags = 0
rate 81713.43 nanos_op 12237
rate 81648.45 nanos_op 12247setImmediatein node.js has a lot of overhead on macos compared to linux. attention was drawn to this in this tweet from jarred sumner.- in the referenced benchmark, node on macos was only able to achieve
80kticks per second of the event loop versus millions per second for Bun & Deno on macos - on linux, difference between node, Bun and Deno are much less significant
- the change implemented in Bun for MacOS uses the
KEVENT_FLAG_IMMEDIATEflag to create a fast return from the syscall when there is no pending io. - the flag in question is only available when using the
kevent64syscall on macos - libuv uses the
keventsyscall, which is common across bsd based platforms. - i built a version of node with [patches](https://github.com
| """ | |
| The most atomic way to train and inference a GPT in pure, dependency-free Python. | |
| This file is the complete algorithm. | |
| Everything else is just efficiency. | |
| @karpathy | |
| """ | |
| import os # os.path.exists | |
| import math # math.log, math.exp |
| import { api } from 'lib/sqlite/api.js' | |
| import { bindall, bind_custom } from 'lib/ffi.js' | |
| import { Bench } from 'lib/bench.js' | |
| const { assert, core, ptr, utf8_length } = lo | |
| const { dlopen, RTLD_NOW, RTLD_LOCAL } = core | |
| const sqlite_handle = assert(dlopen(lo.getenv('SQLITE_SO') || 'libsqlite3.so', RTLD_NOW | RTLD_LOCAL)) | |
| const sqlite = bindall(api, sqlite_handle) | |
| const u32 = ptr(new Uint32Array(2)) |
Configuring a development environment for Bun can take 10-30 minutes depending on your internet connection and computer speed. You will need ~10GB of free disk space for the repository and build artifacts.
If you are using Windows, please refer to this guide
A Nix flake is provided as an alternative to manual dependency installation:
nix develop{
type: "log",
args: [
{
type: "string",
value: "something interesting"
}
],
executionContextId: 1,hi, i'm daniel. i'm a 16-year-old high school senior. in my free time, i hack billion dollar companies and build cool stuff.
about a month ago, a couple of friends and I found serious critical vulnerabilities on Mintlify, an AI documentation platform used by some of the top companies in the world.
i found a critical cross-site scripting vulnerability that, if abused, would let an attacker to inject malicious scripts into the documentation of numerous companies and steal credentials from users with a single link open.
(go read my friends' writeups (after this one))
how to hack discord, vercel, and more with one easy trick (eva)
Redacted by Counsel: A supply chain postmortem (MDL)
tl;dr: If you want to just know the method, skip to How to section
Clangd is a state-of-the-art C/C++ LSP that can be used in every popular text editors like Neovim, Emacs or VS Code. Even CLion uses clangd under the hood. Unfortunately, clangd requires compile_commands.json to work, and the easiest way to painlessly generate it is to use CMake.
For simple projects you can try to use Bear - it will capture compile commands and generate compile_commands.json. Although I could never make it work in big projects with custom or complicated build systems.
But what if I tell you you can quickly hack your way around that, and generate compile_commands.json for any project, no matter how compilcated? I have used that way at work for years, originaly because I used CLion which supported only CMake projects - but now I use that method succesfully with clangd and Neovim.
| // stb_c_lexer.h 0.01 -- public domain Sean Barrett 2013 | |
| // lexer for making little C-like languages with recursive-descent parsers | |
| // | |
| // This file provides both the interface and the implementation. | |
| // To instantiate the implementation, | |
| // #define STB_C_LEXER_IMPLEMENTATION | |
| // in *ONE* source file, before #including this file. | |
| // | |
| // The default configuration is fairly close to a C lexer, although | |
| // suffixes on integer constants are not handled (you can override this). |