Skip to content

Instantly share code, notes, and snippets.

Avatar

Bert Belder piscisaureus

  • Amsterdam
View GitHub Profile
View stack_frames_by_size.txt
First number is the size (in bytes) of the stack frame. The largest frames are on top.
+ 60480 0x000000B1E05AD690 frame #77: 0x00007ff6b6e7fd44 deno.exe`union core::result::Result<swc_ecma_ast::module::ModuleItem, swc_common::errors::diagnostic_builder::DiagnosticBuilder> swc_ecma_parser::parser::Parser<swc_ecma_parser::parser::input::Capturing<swc_ecma_parser::lexer::Lexer<swc_common::input::SourceFileInput>>>::parse_stmt_like<swc_ecma_parser::parser::input::Capturing<swc_ecma_parser::lexer::Lexer<swc_common::input::SourceFileInput>>,swc_ecma_ast::module::ModuleItem>(self=0x000000b1e05b00d0, include_decl=true, top_level=true) at stmt.rs:82
+ 60480 0x000000B1E055F110 frame #48: 0x00007ff6b6e7f784 deno.exe`union core::result::Result<swc_ecma_ast::stmt::Stmt, swc_common::errors::diagnostic_builder::DiagnosticBuilder> swc_ecma_parser::parser::Parser<swc_ecma_parser::parser::input::Capturing<swc_ecma_parser::lexer::Lexer<swc_common::input::SourceFileInput>>>::parse_stmt_like<swc_ecma_parser::parser::input:
View gist:748866df4ac001d631d5f16d5260dbae
D:\deno2\tests>..\target\debug\deno -A --reload main.js
Compile file:///D:/deno2/tests/subdir/mod2.ts
Compile file:///D:/deno2/tests/subdir/mismatch_ext.ts
Compile file:///D:/deno2/tests/subdir/mod1.ts
Download https://raw.githubusercontent.com/denoland/deno/v0.0.1/package.json
error: Uncaught Error: An error
► file:///D:/deno2/tests/subdir/throws.js:5:7
5 throw new Error("An error");
^
View import.js
async function try_import(url) {
let status;
try {
await import(url);
status = "OK";
} catch (err) {
status = err.name;
}
status = status.padEnd(12);
return status + url;
View gist:7ca55b153a1b3f8085c6ae49c4e6c837
So here's the things to consider:
* Do not preallocate a read buffer per socket.
Either use polling or use a shared buffer pool.
* Avoid statefulnews, e.g:
- In windows, you can't use multiple completion ports with a handle.
- On unix, a socket is either in blocking or non-blocking mode
This creates problems when you want to share a handle with other processes
or between threads. For example, you might want to switch stdout to
non-blocking, but if stdout was inherited and shared with the parent
process, the parent process might not expect this and crash or malfunction.
View op_dispatcher.rs
use std::collections::HashMap;
use std::sync::Mutex;
#[macro_use]
extern crate lazy_static;
struct CoreOp {} // Placeholder.
struct FlatBuffer {} // Placeholder.
struct PinnedBuf {} // Placeholder.
View handle_scope_mock.rs
use std::cell::Cell;
use std::marker::PhantomData;
// Dummy placeholders representing raw v8 objects.
struct V8Isolate {}
struct V8HandleScope {}
// Scope that controls access to the Isolate and active HandleScope.
struct Scope<'a, S, P> {
parent: Option<&'a mut P>,
View latch.ts
import { test, runIfMain } from "https://deno.land/std/testing/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
export class Latch<T> {
// Array of `[resolve_function, value]` tuples.
send_queue: Array<[() => void, T]> = []
// Array of `resolve_function` values.
recv_queue: Array<(value: T) => void> = []
send(value: T): Promise<void> {
@piscisaureus
piscisaureus / sccache.exe
Last active Jan 15, 2019
sccache 0.2.8-alpha 9d30660a
View sccache.exe
This file has been truncated, but you can view the full file.
@piscisaureus
piscisaureus / leftspread.d.ts
Last active Nov 7, 2018
Typescript left spread
View leftspread.d.ts
// A typescript helper type that lets you define functions with rest spread
// parameters at the beginning, like:
//
// `function cool(...many: string[], must_have: SomeObject, extra?: boolean)`;
//
// See test.ts for an example on how to use it.
export type Args = Array<unknown>;
// prettier-ignore
View output.txt
C:\Users\BertBelder\d\deno\out\debug>rustc ../../src/main.rs --crate-name=deno_bin --crate-type=staticlib --emit=link,dep-info --out-dir=rust_crates -Cextra-filename= -Cmetadata= -L dependency=rust_crates --color=always -g --extern hyper=rust_crates/libhyper.rlib --extern hyper_rustls=rust_crates/libhyper_rustls.rlib --extern futures=rust_crates/libfutures.rlib --extern lazy_static=rust_crates/liblazy_static.rlib --extern libc=rust_crates/liblibc.rlib --extern log=rust_crates/liblog.rlib --extern ring=rust_crates/libring.rlib --extern tempfile=rust_crates/libtempfile.rlib --extern rand=rust_crates/librand.rlib --extern tokio=rust_crates/libtokio.rlib --extern tokio_io=rust_crates/libtokio_io.rlib --extern tokio_fs=rust_crates/libtokio_fs.rlib --extern tokio_executor=rust_crates/libtokio_executor.rlib --extern tokio_threadpool=rust_crates/libtokio_threadpool.rlib --extern url=rust_crates/liburl.rlib --extern remove_dir_all=rust_crates/libremove_dir_all.rlib --extern dirs=rust_crates/libdirs.rlib --extern flatb
You can’t perform that action at this time.