profile
viewpoint
Valentin Anger SyrupThinker Germany

SyrupThinker/docuraptor 2

Docuraptor is a JS/TS documentation generator and server

SyrupThinker/OC_3DPrintModels 1

A Repository for Models for the OpenComputer 3D Printer

SyrupThinker/deno 0

A secure JavaScript and TypeScript runtime

SyrupThinker/kodi-pokemon-tv 0

This addon allows you watch Pokémon TV with Kodi

SyrupThinker/matrix-doc 0

Matrix Documentation (including The Spec)

pull request commentdenoland/deno

feat(doc): Add detailed flag

I think thats a bad default because it drowns out the relevant information in an overview, but sure. The whole detailed distinction can be removed from the printer then.

SyrupThinker

comment created time in 8 hours

push eventSyrupThinker/docuraptor

Valentin Anger

commit sha 409f270a43b2aee930b0e110da7cd3c243d2e164

Remove accidental absolute font size

view details

Valentin Anger

commit sha 1fc40fd8b1b6a784c00fa203a5e2b53efaedcade

Add content-type header to html responses

view details

Valentin Anger

commit sha 97dd685cf3b4f8991db664fee547e46a90cfd628

Close connection when done Without this browsers like w3m are kept hanging.

view details

Valentin Anger

commit sha e025b6772338bcf88cca9eda379331ad32aa50c6

Elaborate functions and permissions in help

view details

push time in a day

push eventSyrupThinker/docuraptor

Valentin Anger

commit sha 5086ca10a8529aef560a20930507acc2b7b56daa

Add namespaces to sidebar

view details

Valentin Anger

commit sha 15d3d7eff275cb1c934ead5483070f8bcd0deb4b

Add type markers to sidebar and dependencies

view details

Valentin Anger

commit sha 5f9361947b5a1e4cbb11705906841e8ad4170a8d

Use sans-serif for the sidebar, monospace for deps

view details

push time in 7 days

push eventSyrupThinker/docuraptor

Valentin Anger

commit sha 86d98bac7e0246921aa845d36d620cbf6eafde56

Improve CSS - Remove body padding - Do not wrap the module go button - Better sizing of the sidebar

view details

Valentin Anger

commit sha a60d2efb77834139898a0b23520fed7cc890f022

Add support for generating private documentation

view details

Valentin Anger

commit sha cf0837ba1b9c90a9f0c9979682425109fcec3ce4

Render method return type

view details

Valentin Anger

commit sha 2ee80e56d47b311c4fdf9e961c42421cc48a41ce

Append missing semicolon to HTML escapes

view details

push time in 8 days

pull request commentdenoland/deno

Feature: Dependency count and module sizes for `deno info`. Feedback wanted.

There's lots of duplicated sizes here that could be moved out like this:

{
  "...": "...",
  "deps": ["self", ["module"]],
  "metadata": {
    "self": {
      "size": 128
    },
    "module": {
      "size": 1024
    }
  }
}

IMO the total_size field is not needed in the JSON output because

  • Its easy to calculate
  • There are several possible ways of calculating it depending on what the consumer wants to determine (absolute size, contributed size)
KrisChambers

comment created time in 11 days

push eventSyrupThinker/docuraptor

Valentin Anger

commit sha e75f0bc69adf908edfb3d832d109cfe7906bc261

Add support for generating static html files

view details

Valentin Anger

commit sha ac5a6559a49189374948a9d210bd35d416dde02c

Add dark mode support for prefers-color-scheme

view details

Valentin Anger

commit sha 498b1726ec65c2773d740afac0a028177133ba71

Add navigation sidebar to documentation

view details

push time in 11 days

pull request commentdenoland/deno

Fix: Deno.args typings

@scf4 Because the array access is out of bounds. The type only reflects the arrays contents within its bounds.

scf4

comment created time in 15 days

pull request commentdenoland/deno

Fix: Deno.args typings

@nayeemrmn The readonly marker in this position rightfully marks the array as immutable. It is equivalent to ReadonlyArray<...>.

scf4

comment created time in 15 days

pull request commentdenoland/deno

Fix: Deno.args typings

@scf4 Can you provide an example for which an entry is undefined?

scf4

comment created time in 15 days

push eventSyrupThinker/docuraptor

Valentin Anger

commit sha 45e6689e54afa7aebe1d479b23bf97c3226eba35

Fix logo paths

view details

push time in 15 days

PR opened denoland/deno

feat(doc): Add detailed flag

This flag enables detailed view without a filter.

Closes #6816

+24 -2

0 comment

2 changed files

pr created time in 15 days

create barnchSyrupThinker/deno

branch : doc_detailed_flag

created branch time in 15 days

create barnchSyrupThinker/docuraptor

branch : master

created branch time in 15 days

created repositorySyrupThinker/docuraptor

Docuraptor is a JS/TS documentation generator and server

created time in 15 days

create barnchSyrupThinker/docuraptor

branch : master

created branch time in 15 days

created repositorySyrupThinker/docuraptor

Docuraptor is a JS/TS documentation generator and server

created time in 15 days

create barnchSyrupThinker/docuraptor

branch : master

created branch time in 15 days

created repositorySyrupThinker/docuraptor

Docuraptor is a JS/TS documentation generator and server

created time in 15 days

create barnchSyrupThinker/docuraptor

branch : master

created branch time in 15 days

created repositorySyrupThinker/docuraptor

Docuraptor is an offline JS/TS documentation generator and server

created time in 15 days

issue commentdenoland/deno

Deno doc output missing

That is intentional to reduce the amount of information printed in the general case.

You can add for example StandaloneHost to the invocation to get that specific interface with detailed information.

davidcallanan

comment created time in 16 days

issue commentdenoland/deno

Date.toLocaleDateString options not working

Known issue, due to #1968

daquinoaldo

comment created time in 22 days

startedoakserver/oak

started time in 22 days

issue commentdenoland/deno

deno.ns URL and TypeScript dom URL incompatible constructors

@Sameerkash You are importing std@0.61.0 which is not compatible with Deno 1.1.3

mfellner

comment created time in 22 days

delete branch SyrupThinker/deno

delete branch : golang

delete time in 22 days

delete branch SyrupThinker/deno

delete branch : vbump-0.39.0

delete time in 22 days

delete branch SyrupThinker/deno

delete branch : doc_print_tuple_type

delete time in 22 days

delete branch SyrupThinker/deno

delete branch : remove_control_slice

delete time in 22 days

delete branch SyrupThinker/deno

delete branch : doc_improvements

delete time in 22 days

issue commentdenoland/deno

Consider "release" branch of std

Making release the new default branch just extends the cycle when modules break. With unversioned std imports every breaking change in std, whether intentional (2.0 etc) or not, will break part of the ecosystem. With versioned ones it will keep working as long as the runtime supports what is used, for example pure JS modules that have just been (re)moved in later releases.

kitsonk

comment created time in 22 days

issue commentdenoland/deno

Listening on unix sockets

Like this?

danbulant

comment created time in 23 days

issue commentdenoland/deno

Limited Permission for --allow-env

I misunderstood how you meant "a comma separated list is easy to break". I thought you meant breaking apart (aka splitting), sorry.

The last few comments didn't make that obvious to me.

keroxp

comment created time in a month

issue commentdenoland/deno

Limited Permission for --allow-env

existing values would have to be filled in by the caller

commonplace for env variables to contain comma seperated lists

Exactly this makes string interpolation bad because: a="a,b,c=1" deno ... --env "a=$a" ...results in--env 'a=a,b,c=1'` which is obviously not what meant.

Quoting wouldn't help because a="Secret'with,weird,chars" deno ... --env "a='$a'" ... it'd break like `--env "a='Secret'with,weird,chars'".

And doing something like --env "a=$(deno escape $a)" is plain ugly.

keroxp

comment created time in a month

issue commentdenoland/deno

Limited Permission for --allow-env

How about --env "foo,bar,baz=1"? With interpolation I need to ensure its properly escaped

keroxp

comment created time in a month

push eventSyrupThinker/deno

Valentin Anger

commit sha e83a6dad371ac43ab8eb1c269f9c5366651f2208

Add partial support for argument destructuring

view details

Valentin Anger

commit sha ccbcc18471868f0dd8593dd6317b859badedf3cd

Add support for index signatures

view details

push time in a month

pull request commentdenoland/deno

Remove control slice from ops

land some fixes for the issue Bartek brought up

Thats what the last commit did ;)

SyrupThinker

comment created time in a month

push eventSyrupThinker/deno

Valentin Anger

commit sha a2dfe4f0cfdd85649549875749e2f3ff382a1b59

Check existence of control field for metrics

view details

push time in a month

pull request commentdenoland/deno

Remove control slice from ops

I think there should be some validation added in core/bindings.rs::send that there's at least one zero copy buffer passed or some JS error returned informing that too few arguments were passed.

That seems like an arbitrary restriction to me. If my op just changes the system state and doesn't take parameters why should I be forced to pass an argument anyway? The plugin API could add support for defining arity of a function, but I'm not sure how helpful that is considering that normal user should never call ops directly.

SyrupThinker

comment created time in a month

push eventSyrupThinker/deno

Valentin Anger

commit sha a8f6dd6a738863a8f2b541e4a5b90938e22109ed

Add missing license header

view details

push time in a month

pull request commentdenoland/deno

Remove control slice from ops

What's the status on this?

SyrupThinker

comment created time in a month

push eventSyrupThinker/deno

Benjamin Lupton

commit sha d16337cc9c59732fe81655482e08b72d844472e6

fix(std/node): global process should usable (#6392)

view details

Benjamin Lupton

commit sha 49c54c0805ab26410a62e0251fee3a28b98c0e13

fix(std/node): fix readFile types, add encoding types (#6451)

view details

Chris Couzens

commit sha f6a41469730e8dcd0995d3e5dd370b9410c65ba4

fix(cli/web): Support URLSearchParam as Body (#6416) The following used to fail in Deno despite working in the browser: ```javascript new Request('http://localhost/', {method: 'POST', body: new URLSearchParams({hello: 'world'})}).text().then(console.log) ```

view details

Kitson Kelly

commit sha 1d8fc394945fb4447cec23fbfc61fc8961126b7a

Add ability to output compiler performance information (#6434)

view details

Casper Beyer

commit sha f318ab01a47cecac9df62d11cb0c745f39523da9

fix(std/testing) assertArrayContains should work with any array-like (#6402)

view details

Colin Harrington

commit sha f4397e5ec99c539e4c6977e3eff873d672f98413

Update contributing.md for consistency (#6452)

view details

Casper Beyer

commit sha a354b248ea8ecb7fb10742322d7a36ad71eddf0a

feat(std/wasi): add wasi_snapshot_preview1 (#6441)

view details

Colin Harrington

commit sha 702547d65a9cb60ca6672792c08225b1c3099bad

fix(cli): ipv6 parsing for --allow-net params (#6453) Co-authored-by: Liming Jin <jinliming2@gmail.com>

view details

Nayeem Rahman

commit sha 3314b463215a8e59ec46d722adb70a22cd3ef832

fix(cli/js/web/console): Improve string quoting behaviour (#6457)

view details

Bartek Iwańczuk

commit sha 3cbd1075c78703b4852760ec5bfa2e4dbb53c737

Incremental compilation for TypeScript (#6428) This commit adds incremental compilation capabilities to internal TS compiler. Instead of using "ts.createProgram()" API for compilation step (during deno startup), "ts.createIncrementalProgram()" API is used instead. Thanks to TS' ".tsbuildinfo" file that already stores all necessary metadata for compilation I was able to remove our own invention that is ".graph" file. ".tsbuildinfo" file is stored alongside compiled source and is used to cache-bust outdated dependencies, facilitated by the "version" field. The value for "version" field is computed in Rust during loading of module graph and is basically a hash of the file contents. Please keep in mind that incremental compilation is only used for initial compilation (or dynamic imports compilation) - bundling and runtime compiler APIs haven't been changed at all. Due to problems with source map I changed compilation settings to inline source map (inlineSourceMap instead of sourceMap).

view details

Ryan Dahl

commit sha 062086260520c2a24bfd8e840295ecd0f55120af

Clean up some fetch_remote_source tets (#6446)

view details

Casper Beyer

commit sha f39c890714ad4479b42be8f24ffda185a062bd16

doc(std/wasi) add a list of supported syscalls (#6460)

view details

Bartek Iwańczuk

commit sha 6bbe52fba33e440e113bca423b5eae0d1f320c49

Revert "fix(cli): ipv6 parsing for --allow-net params (#6453)" (#6458)

view details

Casper Beyer

commit sha 87f8f99c49e62c06f85bb453a7c12b32634c3bef

refactor(cli/tests/unit) to use assertThrows (#6459)

view details

Marcos Casagrande

commit sha 6527189520b62c08f0e376a5a1f0163f0de82baa

doc(std/wasi): fix example (#6464)

view details

Chris Knight

commit sha c98038a03228d527cd90d9f1fc0118a3fe47dce0

doc: add info on installing wasm32-wasi target (#6470)

view details

Chris Knight

commit sha d9896d64ce919a46a6e8c6666c3b87cc9ae79b7b

refactor: shift copyBytes and tweak deps to reduce dependencies (#6469)

view details

Casper Beyer

commit sha ab0f12fcb80d6ad9bb74c9ba427fc73d302831ab

Remove stale comment referring to deleted code (#6462)

view details

Stanislav

commit sha 7ea3071db5b05cfe284fecfed28a66f7508dad6d

docs: replace delCookie with deleteCookie (#6467)

view details

Benjamin Lupton

commit sha 16038b8f82d0f3f610d97d721c39d6585fe90295

fix(std/node/process): env, argv exports (#6455) The promise approach still required permissions to be specified at initialisation, rather than at request. Using a Proxy instance solves this permission issue. The Proxy instance approach also eliminates the need for the await. Achieving direct compatibility with Node.js. /ref pr #6392 /ref commit d16337cc9c59732fe81655482e08b72d844472e6

view details

push time in a month

Pull request review commentdenoland/deno

Improve doc module

  use crate::colors; use crate::doc;-use crate::doc::ts_type::TsTypeDefKind;+use crate::doc::display::{+  display_abstract, display_async, display_generator, Indent, SliceDisplayer,+}; use crate::doc::DocNodeKind; use crate::swc_ecma_ast;+use std::fmt::{Display, Formatter, Result as FmtResult}; -pub fn format(doc_nodes: Vec<doc::DocNode>) -> String {-  format_(doc_nodes, 0)+pub struct DocPrinter<'a> {+  doc_nodes: &'a [doc::DocNode],+  details: bool,+  private: bool, } -pub fn format_details(node: doc::DocNode) -> String {-  let mut details = String::new();+impl<'a> DocPrinter<'a> {+  pub fn new(+    doc_nodes: &[doc::DocNode],+    details: bool,+    private: bool,+  ) -> DocPrinter {+    DocPrinter {+      doc_nodes,+      details,+      private,+    }+  } -  details.push_str(&format!(-    "{}",-    colors::gray(&format!(-      "Defined in {}:{}:{} \n\n",-      node.location.filename, node.location.line, node.location.col-    ))-  ));+  pub fn format(&self, w: &mut Formatter<'_>) -> FmtResult {+    if self.details {+      self.format_details(w, self.doc_nodes, 0)+    } else {+      self.format_summary(w, self.doc_nodes, 0)+    }+  } -  details.push_str(&format_signature(&node, 0));+  fn format_summary(+    &self,+    w: &mut Formatter<'_>,+    doc_nodes: &[doc::DocNode],+    indent: i64,+  ) -> FmtResult {+    let mut sorted = Vec::from(doc_nodes);+    sorted.sort_unstable_by(|a, b| {+      let kind_cmp = self.kind_order(&a.kind).cmp(&self.kind_order(&b.kind));+      if kind_cmp == core::cmp::Ordering::Equal {+        a.name.cmp(&b.name)+      } else {+        kind_cmp+      }+    }); -  let js_doc = node.js_doc.clone();-  if let Some(js_doc) = js_doc {-    details.push_str(&format_jsdoc(js_doc, 1));-  }-  details.push_str("\n");+    for node in sorted {+      self.format_signature(w, &node, indent)?; -  let maybe_extra = match node.kind {-    DocNodeKind::Class => Some(format_class_details(node)),-    DocNodeKind::Enum => Some(format_enum_details(node)),-    DocNodeKind::Namespace => Some(format_namespace_details(node)),-    _ => None,-  };+      if let Some(js_doc) = &node.js_doc {+        self.format_jsdoc(w, js_doc, indent + 1, self.details)?;+      } -  if let Some(extra) = maybe_extra {-    details.push_str(&extra);-  }+      writeln!(w)?; -  details-}+      if DocNodeKind::Namespace == node.kind {+        self.format_summary(+          w,+          &node.namespace_def.as_ref().unwrap().elements,+          indent + 1,+        )?; -fn kind_order(kind: &doc::DocNodeKind) -> i64 {-  match kind {-    DocNodeKind::Function => 0,-    DocNodeKind::Variable => 1,-    DocNodeKind::Class => 2,-    DocNodeKind::Enum => 3,-    DocNodeKind::Interface => 4,-    DocNodeKind::TypeAlias => 5,-    DocNodeKind::Namespace => 6,-  }-}+        writeln!(w)?;+      };+    } -fn format_signature(node: &doc::DocNode, indent: i64) -> String {-  match node.kind {-    DocNodeKind::Function => format_function_signature(&node, indent),-    DocNodeKind::Variable => format_variable_signature(&node, indent),-    DocNodeKind::Class => format_class_signature(&node, indent),-    DocNodeKind::Enum => format_enum_signature(&node, indent),-    DocNodeKind::Interface => format_interface_signature(&node, indent),-    DocNodeKind::TypeAlias => format_type_alias_signature(&node, indent),-    DocNodeKind::Namespace => format_namespace_signature(&node, indent),+    Ok(())   }-} -fn format_(doc_nodes: Vec<doc::DocNode>, indent: i64) -> String {-  let mut sorted = doc_nodes;-  sorted.sort_unstable_by(|a, b| {-    let kind_cmp = kind_order(&a.kind).cmp(&kind_order(&b.kind));-    if kind_cmp == core::cmp::Ordering::Equal {-      a.name.cmp(&b.name)-    } else {-      kind_cmp+  fn format_details(+    &self,+    w: &mut Formatter<'_>,+    doc_nodes: &[doc::DocNode],+    indent: i64,+  ) -> FmtResult {+    for node in doc_nodes {+      write!(+        w,+        "{}",+        colors::italic_gray(&format!(+          "Defined in {}:{}:{} \n\n",+          node.location.filename, node.location.line, node.location.col+        ))+      )?;++      self.format_signature(w, &node, indent)?;++      let js_doc = &node.js_doc;+      if let Some(js_doc) = js_doc {+        self.format_jsdoc(w, js_doc, indent + 1, self.details)?;+      }+      writeln!(w)?;++      match node.kind {+        DocNodeKind::Class => self.format_class_details(w, node)?,+        DocNodeKind::Enum => self.format_enum_details(w, node)?,+        DocNodeKind::Interface => self.format_interface_details(w, node)?,+        DocNodeKind::Namespace => self.format_namespace_details(w, node)?,+        _ => {}+      }     }-  }); -  let mut output = String::new();+    Ok(())+  } -  for node in sorted {-    output.push_str(&format_signature(&node, indent));-    if let Some(js_doc) = node.js_doc {-      output.push_str(&format_jsdoc(js_doc, indent));+  fn kind_order(&self, kind: &doc::DocNodeKind) -> i64 {+    match kind {+      DocNodeKind::Function => 0,+      DocNodeKind::Variable => 1,+      DocNodeKind::Class => 2,+      DocNodeKind::Enum => 3,+      DocNodeKind::Interface => 4,+      DocNodeKind::TypeAlias => 5,+      DocNodeKind::Namespace => 6,     }-    output.push_str("\n");-    if DocNodeKind::Namespace == node.kind {-      output.push_str(&format_(-        node.namespace_def.as_ref().unwrap().elements.clone(),-        indent + 1,-      ));-      output.push_str("\n");-    };   } -  output-}--fn render_params(params: Vec<doc::ParamDef>) -> String {-  let mut rendered = String::from("");-  if !params.is_empty() {-    for param in params {-      rendered += param.name.as_str();-      if param.optional {-        rendered += "?";+  fn format_signature(+    &self,+    w: &mut Formatter<'_>,+    node: &doc::DocNode,+    indent: i64,+  ) -> FmtResult {+    match node.kind {+      DocNodeKind::Function => self.format_function_signature(w, node, indent),+      DocNodeKind::Variable => self.format_variable_signature(w, node, indent),+      DocNodeKind::Class => self.format_class_signature(w, node, indent),+      DocNodeKind::Enum => self.format_enum_signature(w, node, indent),+      DocNodeKind::Interface => {+        self.format_interface_signature(w, node, indent)+      }+      DocNodeKind::TypeAlias => {+        self.format_type_alias_signature(w, node, indent)       }-      if let Some(ts_type) = param.ts_type {-        rendered += ": ";-        rendered += render_ts_type(ts_type).as_str();+      DocNodeKind::Namespace => {+        self.format_namespace_signature(w, node, indent)       }-      rendered += ", ";     }-    rendered.truncate(rendered.len() - 2);   }-  rendered-} -fn render_ts_type(ts_type: doc::ts_type::TsTypeDef) -> String {-  if ts_type.kind.is_none() {-    return "<UNIMPLEMENTED>".to_string();-  }-  let kind = ts_type.kind.unwrap();-  match kind {-    TsTypeDefKind::Array => {-      format!("{}[]", render_ts_type(*ts_type.array.unwrap()))-    }-    TsTypeDefKind::Conditional => {-      let conditional = ts_type.conditional_type.unwrap();-      format!(-        "{} extends {} ? {} : {}",-        render_ts_type(*conditional.check_type),-        render_ts_type(*conditional.extends_type),-        render_ts_type(*conditional.true_type),-        render_ts_type(*conditional.false_type)-      )-    }-    TsTypeDefKind::FnOrConstructor => {-      let fn_or_constructor = ts_type.fn_or_constructor.unwrap();-      format!(-        "{}({}) => {}",-        if fn_or_constructor.constructor {-          "new "-        } else {-          ""-        },-        render_params(fn_or_constructor.params),-        render_ts_type(fn_or_constructor.ts_type),-      )-    }-    TsTypeDefKind::IndexedAccess => {-      let indexed_access = ts_type.indexed_access.unwrap();-      format!(-        "{}[{}]",-        render_ts_type(*indexed_access.obj_type),-        render_ts_type(*indexed_access.index_type)-      )-    }-    TsTypeDefKind::Intersection => {-      let intersection = ts_type.intersection.unwrap();-      let mut output = "".to_string();-      if !intersection.is_empty() {-        for ts_type in intersection {-          output += render_ts_type(ts_type).as_str();-          output += " & "-        }-        output.truncate(output.len() - 3);+  // TODO(SyrupThinker) this should use a JSDoc parser+  fn format_jsdoc(+    &self,+    w: &mut Formatter<'_>,+    jsdoc: &str,+    indent: i64,+    details: bool,+  ) -> FmtResult {

It does: image

SyrupThinker

comment created time in a month

Pull request review commentdenoland/deno

Improve doc module

 pub trait DocFileLoader { pub struct DocParser {   pub ast_parser: AstParser,   pub loader: Box<dyn DocFileLoader>,+  pub private: bool,

It'll be fine when it lands in 1.2.0

SyrupThinker

comment created time in a month

Pull request review commentdenoland/deno

Improve doc module

  use crate::colors; use crate::doc;-use crate::doc::ts_type::TsTypeDefKind;+use crate::doc::display::{+  display_abstract, display_async, display_generator, Indent, SliceDisplayer,+}; use crate::doc::DocNodeKind; use crate::swc_ecma_ast;+use std::fmt::{Display, Formatter, Result as FmtResult}; -pub fn format(doc_nodes: Vec<doc::DocNode>) -> String {-  format_(doc_nodes, 0)+pub struct DocPrinter<'a> {+  doc_nodes: &'a [doc::DocNode],+  details: bool,+  private: bool, } -pub fn format_details(node: doc::DocNode) -> String {-  let mut details = String::new();+impl<'a> DocPrinter<'a> {+  pub fn new(+    doc_nodes: &[doc::DocNode],+    details: bool,+    private: bool,+  ) -> DocPrinter {+    DocPrinter {+      doc_nodes,+      details,+      private,+    }+  } -  details.push_str(&format!(-    "{}",-    colors::gray(&format!(-      "Defined in {}:{}:{} \n\n",-      node.location.filename, node.location.line, node.location.col-    ))-  ));+  pub fn format(&self, w: &mut Formatter<'_>) -> FmtResult {+    if self.details {+      self.format_details(w, self.doc_nodes, 0)+    } else {+      self.format_summary(w, self.doc_nodes, 0)+    }+  } -  details.push_str(&format_signature(&node, 0));+  fn format_summary(+    &self,+    w: &mut Formatter<'_>,+    doc_nodes: &[doc::DocNode],+    indent: i64,+  ) -> FmtResult {+    let mut sorted = Vec::from(doc_nodes);+    sorted.sort_unstable_by(|a, b| {+      let kind_cmp = self.kind_order(&a.kind).cmp(&self.kind_order(&b.kind));+      if kind_cmp == core::cmp::Ordering::Equal {+        a.name.cmp(&b.name)+      } else {+        kind_cmp+      }+    }); -  let js_doc = node.js_doc.clone();-  if let Some(js_doc) = js_doc {-    details.push_str(&format_jsdoc(js_doc, 1));-  }-  details.push_str("\n");+    for node in sorted {+      self.format_signature(w, &node, indent)?; -  let maybe_extra = match node.kind {-    DocNodeKind::Class => Some(format_class_details(node)),-    DocNodeKind::Enum => Some(format_enum_details(node)),-    DocNodeKind::Namespace => Some(format_namespace_details(node)),-    _ => None,-  };+      if let Some(js_doc) = &node.js_doc {+        self.format_jsdoc(w, js_doc, indent + 1, self.details)?;+      } -  if let Some(extra) = maybe_extra {-    details.push_str(&extra);-  }+      writeln!(w)?; -  details-}+      if DocNodeKind::Namespace == node.kind {+        self.format_summary(+          w,+          &node.namespace_def.as_ref().unwrap().elements,+          indent + 1,+        )?; -fn kind_order(kind: &doc::DocNodeKind) -> i64 {-  match kind {-    DocNodeKind::Function => 0,-    DocNodeKind::Variable => 1,-    DocNodeKind::Class => 2,-    DocNodeKind::Enum => 3,-    DocNodeKind::Interface => 4,-    DocNodeKind::TypeAlias => 5,-    DocNodeKind::Namespace => 6,-  }-}+        writeln!(w)?;+      };+    } -fn format_signature(node: &doc::DocNode, indent: i64) -> String {-  match node.kind {-    DocNodeKind::Function => format_function_signature(&node, indent),-    DocNodeKind::Variable => format_variable_signature(&node, indent),-    DocNodeKind::Class => format_class_signature(&node, indent),-    DocNodeKind::Enum => format_enum_signature(&node, indent),-    DocNodeKind::Interface => format_interface_signature(&node, indent),-    DocNodeKind::TypeAlias => format_type_alias_signature(&node, indent),-    DocNodeKind::Namespace => format_namespace_signature(&node, indent),+    Ok(())   }-} -fn format_(doc_nodes: Vec<doc::DocNode>, indent: i64) -> String {-  let mut sorted = doc_nodes;-  sorted.sort_unstable_by(|a, b| {-    let kind_cmp = kind_order(&a.kind).cmp(&kind_order(&b.kind));-    if kind_cmp == core::cmp::Ordering::Equal {-      a.name.cmp(&b.name)-    } else {-      kind_cmp+  fn format_details(+    &self,+    w: &mut Formatter<'_>,+    doc_nodes: &[doc::DocNode],+    indent: i64,+  ) -> FmtResult {+    for node in doc_nodes {+      write!(+        w,+        "{}",+        colors::italic_gray(&format!(+          "Defined in {}:{}:{} \n\n",+          node.location.filename, node.location.line, node.location.col+        ))+      )?;++      self.format_signature(w, &node, indent)?;++      let js_doc = &node.js_doc;+      if let Some(js_doc) = js_doc {+        self.format_jsdoc(w, js_doc, indent + 1, self.details)?;+      }+      writeln!(w)?;++      match node.kind {+        DocNodeKind::Class => self.format_class_details(w, node)?,+        DocNodeKind::Enum => self.format_enum_details(w, node)?,+        DocNodeKind::Interface => self.format_interface_details(w, node)?,+        DocNodeKind::Namespace => self.format_namespace_details(w, node)?,+        _ => {}+      }     }-  }); -  let mut output = String::new();+    Ok(())+  } -  for node in sorted {-    output.push_str(&format_signature(&node, indent));-    if let Some(js_doc) = node.js_doc {-      output.push_str(&format_jsdoc(js_doc, indent));+  fn kind_order(&self, kind: &doc::DocNodeKind) -> i64 {+    match kind {+      DocNodeKind::Function => 0,+      DocNodeKind::Variable => 1,+      DocNodeKind::Class => 2,+      DocNodeKind::Enum => 3,+      DocNodeKind::Interface => 4,+      DocNodeKind::TypeAlias => 5,+      DocNodeKind::Namespace => 6,     }-    output.push_str("\n");-    if DocNodeKind::Namespace == node.kind {-      output.push_str(&format_(-        node.namespace_def.as_ref().unwrap().elements.clone(),-        indent + 1,-      ));-      output.push_str("\n");-    };   } -  output-}--fn render_params(params: Vec<doc::ParamDef>) -> String {-  let mut rendered = String::from("");-  if !params.is_empty() {-    for param in params {-      rendered += param.name.as_str();-      if param.optional {-        rendered += "?";+  fn format_signature(+    &self,+    w: &mut Formatter<'_>,+    node: &doc::DocNode,+    indent: i64,+  ) -> FmtResult {+    match node.kind {+      DocNodeKind::Function => self.format_function_signature(w, node, indent),+      DocNodeKind::Variable => self.format_variable_signature(w, node, indent),+      DocNodeKind::Class => self.format_class_signature(w, node, indent),+      DocNodeKind::Enum => self.format_enum_signature(w, node, indent),+      DocNodeKind::Interface => {+        self.format_interface_signature(w, node, indent)+      }+      DocNodeKind::TypeAlias => {+        self.format_type_alias_signature(w, node, indent)       }-      if let Some(ts_type) = param.ts_type {-        rendered += ": ";-        rendered += render_ts_type(ts_type).as_str();+      DocNodeKind::Namespace => {+        self.format_namespace_signature(w, node, indent)       }-      rendered += ", ";     }-    rendered.truncate(rendered.len() - 2);   }-  rendered-} -fn render_ts_type(ts_type: doc::ts_type::TsTypeDef) -> String {-  if ts_type.kind.is_none() {-    return "<UNIMPLEMENTED>".to_string();-  }-  let kind = ts_type.kind.unwrap();-  match kind {-    TsTypeDefKind::Array => {-      format!("{}[]", render_ts_type(*ts_type.array.unwrap()))-    }-    TsTypeDefKind::Conditional => {-      let conditional = ts_type.conditional_type.unwrap();-      format!(-        "{} extends {} ? {} : {}",-        render_ts_type(*conditional.check_type),-        render_ts_type(*conditional.extends_type),-        render_ts_type(*conditional.true_type),-        render_ts_type(*conditional.false_type)-      )-    }-    TsTypeDefKind::FnOrConstructor => {-      let fn_or_constructor = ts_type.fn_or_constructor.unwrap();-      format!(-        "{}({}) => {}",-        if fn_or_constructor.constructor {-          "new "-        } else {-          ""-        },-        render_params(fn_or_constructor.params),-        render_ts_type(fn_or_constructor.ts_type),-      )-    }-    TsTypeDefKind::IndexedAccess => {-      let indexed_access = ts_type.indexed_access.unwrap();-      format!(-        "{}[{}]",-        render_ts_type(*indexed_access.obj_type),-        render_ts_type(*indexed_access.index_type)-      )-    }-    TsTypeDefKind::Intersection => {-      let intersection = ts_type.intersection.unwrap();-      let mut output = "".to_string();-      if !intersection.is_empty() {-        for ts_type in intersection {-          output += render_ts_type(ts_type).as_str();-          output += " & "-        }-        output.truncate(output.len() - 3);+  // TODO(SyrupThinker) this should use a JSDoc parser+  fn format_jsdoc(+    &self,+    w: &mut Formatter<'_>,+    jsdoc: &str,+    indent: i64,+    details: bool,+  ) -> FmtResult {

Yes. Previously it printed the entire documentation and removed newlines assuming that it is Markdown formatted. IMO that made it unusable because either long documentation comments drowned out the relevant information or they were hard to read.

Now it doesn't remove newlines making the output more readable and in summaries it stops at the first blank line. Usually doc comments are written with a quick summary at the beginning so I consider it an acceptable assumption. They are also likely formatted in a way that is readable in a text editor so that should be usable in the terminal too.

As denoted in a comment it should use an actual JSDoc parser once one is available to utilize the @summary tag and take other tags into account.

SyrupThinker

comment created time in a month

Pull request review commentdenoland/deno

Improve doc module

 impl DocFileLoader for TestLoader {   } } -#[tokio::test]-async fn export_fn() {-  let source_code = r#"/**-* @module foo-*/--/**-* Hello there, this is a multiline JSdoc.-*-* It has many lines-*-* Or not that many?-*/-export function foo(a: string, b?: number, cb: (...cbArgs: unknown[]) => void, ...args: unknown[]): void {-    /**-     * @todo document all the things.-     */-    console.log("Hello world");+macro_rules! doc_test {+  ( $name:ident, $source:expr; $block:block ) => {+    doc_test!($name, $source, false, false; $block);+  };++  ( $name:ident, $source:expr, details; $block:block ) => {+    doc_test!($name, $source, true, false; $block);+  };++  ( $name:ident, $source:expr, private; $block:block ) => {+    doc_test!($name, $source, false, true; $block);+  };++  ( $name:ident, $source:expr, details, private; $block:block ) => {+    doc_test!($name, $source, true, true; $block);+  };++  ( $name:ident, $source:expr, $details:expr, $private:expr; $block:block ) => {+    #[tokio::test]+    async fn $name() {+      let source_code = $source;+      let details = $details;+      let private = $private;++      let loader =+        TestLoader::new(vec![("test.ts".to_string(), source_code.to_string())]);+      let entries = DocParser::new(loader, private)+        .parse("test.ts")+        .await+        .unwrap();++      let doc = DocPrinter::new(&entries, details, private).to_string();+      #[allow(unused_variables)]

json_test!s don't use the doc variable, so in those tests it would then have doc unused.

SyrupThinker

comment created time in a month

push eventSyrupThinker/deno

Valentin Anger

commit sha 21d5b7a1316720fed4c20b11cd7288919d5b5950

Fix "accesibility" typo

view details

Valentin Anger

commit sha 4ad6b05a7439a998e919b61bacd7ef177ad74695

Show deconstructed parameters as unimplemented

view details

Valentin Anger

commit sha d7377510a4a517ec0fd5504c48d80cdc528c6305

Add tests

view details

push time in a month

pull request commentdenoland/deno

Improve doc module

This causes changes to the --json output, so doc.deno.land would need to be updated.

SyrupThinker

comment created time in a month

push eventSyrupThinker/deno

Valentin Anger

commit sha 90bffe80d5f5979f6cd0ad7b94a6b30fa363cbd5

Display JSDoc for namespaces

view details

push time in a month

PR opened denoland/deno

Improve doc module
  • Add more support for generics
  • Add the --private flag Displays documentation for not exported and private nodes
  • Display more attributes like abstract, static and readonly
  • Display type aliases
  • Refactor module to use the Display trait
  • Use a bit more color

<details>

<summary>Before after comparison</summary>

https://doc.deno.land/https/gist.github.com/SyrupThinker/719afb9998f8ca7c9497a7bebf0f0ce2/raw/944be1c3a792125bb528324204ba8c11464f5b23/doc_test.ts

image

</details>


TODO:

  • Tests
  • Namespaces

Resolves: #6541

+1064 -614

0 comment

13 changed files

pr created time in a month

create barnchSyrupThinker/deno

branch : doc_improvements

created branch time in a month

delete branch SyrupThinker/deno

delete branch : embrace_slices

delete time in a month

issue commentdenoland/deno

refactor: Rewrite terminal printer for "deno doc"

I'm already working on this. It's the reason for my last PR (:

bartlomieju

comment created time in a month

PR opened denoland/deno

Util functions take slices instead of heap values

Several functions in the checksum, colors and diff modules take heap allocated collections instead of the for their purposes sufficient slices. This PR changes these functions to take slices instead which eliminates several heap allocations.

+118 -152

0 comment

16 changed files

pr created time in a month

create barnchSyrupThinker/deno

branch : embrace_slices

created branch time in a month

push eventSyrupThinker/deno

Valentin Anger

commit sha abace86b392ad7f739f87021ad5b058eff8bba26

Add test

view details

push time in a month

push eventSyrupThinker/deno

Valentin Anger

commit sha ffef89ca42d7dcfac9b471da0ac132d9d7672500

Revert "Add doc test" This reverts commit 7d3f707c0cbe7f93dd0299ec71e1b858eaead5fe.

view details

Valentin Anger

commit sha bf4c9c0101117d4f3bf96d8b428ff2c0d3d142b8

Add test

view details

push time in a month

Pull request review commentdenoland/deno

Fix doc printer missing [] around tuple type

 pub fn run_python_script(script: &str) { }  #[derive(Debug, Default)]-pub struct CheckOutputIntegrationTest {-  pub args: &'static str,-  pub output: &'static str,-  pub input: Option<&'static str>,-  pub output_str: Option<&'static str>,+pub struct CheckOutputIntegrationTest<'a> {+  pub args: &'a str,+  pub output: &'a str,+  pub input: Option<&'a str>,+  pub output_str: Option<&'a str>,

It is related to the commit already requested to be reverted ;)

SyrupThinker

comment created time in a month

starteddenoland/rusty_v8

started time in a month

push eventSyrupThinker/deno

Valentin Anger

commit sha 7d3f707c0cbe7f93dd0299ec71e1b858eaead5fe

Add doc test

view details

push time in a month

push eventSyrupThinker/deno

Valentin Anger

commit sha 846a8cd994f26bc0d164f4aef62ebe0483b4f170

Add doc test

view details

push time in a month

PR opened denoland/deno

Fix doc printer missing [] around tuple type

deno doc generates the following incorrect documentation for this file.

function one(i: Generic<number, string>): Generic<number, string>

function two(i: GenericTwo<number, string>): GenericTwo<number, string>

interface Generic

interface GenericTwo

With the tuple type printing fixed it now generates this documentation:

function one(i: Generic<[number, string]>): Generic<[number, string]>

function two(i: GenericTwo<number, string>): GenericTwo<number, string>

interface Generic

interface GenericTwo
+2 -1

0 comment

1 changed file

pr created time in a month

create barnchSyrupThinker/deno

branch : doc_print_tuple_type

created branch time in a month

Pull request review commentdenoland/deno

Expose assert globally

 export function equal(c: unknown, d: unknown): boolean {   })(c, d); } -/** Make an assertion, if not `true`, then throw. */-export function assert(expr: unknown, msg = ""): asserts expr {-  if (!expr) {-    throw new AssertionError(msg);-  }-}+export const assert: (+  condition: unknown,+  message?: string | undefined+) => asserts condition = Deno.assert;

Unconditionally assigning Deno.assert makes the asserts module incompatible with other runtimes. Maybe it should be done like in line 18 to preserve compatibility?

kitsonk

comment created time in a month

push eventSyrupThinker/deno

Valentin Anger

commit sha d03586d084d6a94f0c38791ef6009457470a268f

Update ZeroCopyBuf documentation

view details

push time in a month

push eventSyrupThinker/deno

Bert Belder

commit sha 7069d60423979858ece856d52ef9567a50f8ef76

ci: use upstream actions/cache@v2 (#6113) Upstream finally tagged v2.0.0 so there's no reason to use our own fork any longer.

view details

Bert Belder

commit sha 9a783ae4e6789fc90c8a6d62e846c9abd29e7d2f

ci: upgrade to Rust 1.44.0 (#6113)

view details

Andrew Mitchell

commit sha c4c6a8dae488a3473ee09b0e3a54943b706d8944

fix: Use # to denote line number in stack traces (#6114) This makes the URLs in stack traces actual URLs to the files. Before: https://deno.land/std/testing/asserts.ts:138:11 After: https://deno.land/std/testing/asserts.ts#138:11

view details

Ryan Dahl

commit sha 78bfeebad11954666d3104ea3556ec9f2e64f6a4

Revert "fix: Use # to denote line number in stack traces" (#6119) This reverts commit c4c6a8dae488a3473ee09b0e3a54943b706d8944 There is some controversy about this change because vscode doesn't interpret the fragments correctly. Needs more discussion before landing.

view details

Bert Belder

commit sha ee7727cd078b56d2ecc5d93f9308709e60a18949

To find home dir, use only $USERPROFILE on Windows, $HOME on Posix (#6132) $HOME is meaningless on Windows. It may be set by users or by third party software, but it is non-standard and should not be relied upon. Likewise, $USERPROFILE is meaningless on other platforms.

view details

Bert Belder

commit sha 18670c47e69ec2b9ceef6ec0011fbbdc4b845be6

fix: 'deno upgrade' doesn't work on Windows 8.1/PowerShell 4.0 (#6132) Fixes: #6109

view details

Taisuke Fukuno

commit sha d2243b1125722e775b1f9719197260d1cda1220d

deno test should run mjs files (#6122)

view details

Ryan Dahl

commit sha 79d9cf52d0298ba85e0ac4a58014116bb84bfc59

fix(core): ES module snapshots (#6111) Co-authored-by: Bert Belder <bertbelder@gmail.com>

view details

Taisuke Fukuno

commit sha 93175b7a79e09381ea556539f10cde9eaa61af89

added mjs files for default fmt (#6134)

view details

Chris Knight

commit sha c137b11abfb946ef72a5fcb27e11e0b286a33be3

fix: revert setInterval log flushing as it prevents process completion (#6127)

view details

Casper Beyer

commit sha ed5aedc6b4a1d72208649afd8793e288d94021b1

Rename abbreviated assertions in std/testing (#6118)

view details

Deepak Vishwakarma

commit sha ee192b075819ccc3a6e3dfbf0eab36fd090fced4

added documentation with sample for std/io mod (#6106)

view details

Mark Tiedemann

commit sha 2093ee55d4c728448a3db373dd416b6eea845c14

Chunk prettier invocation (#6129) This avoids failures due to exceeding the maximum command line length. Fixes: #5017

view details

Ryan Dahl

commit sha 8a4533eb75ff505f8aa16c206af1ca13f0e6c166

feat: deno eval -p (#5682)

view details

Filippo Rossi

commit sha 78333f0ab3614e8dbd3dfdc95e9dbb53f80ffe5d

Add diff for "deno fmt --check" (#5599)

view details

Ryan Dahl

commit sha 1a2f88609b3e1bc27790c77331ac96b423625eb6

fix(std/io): StringReader implementation (#6148)

view details

Akshat Agarwal

commit sha 1e709387e4a24d844302531705f9bbc14b8c3199

Add "fork" method on DenoPermissions, PermissionState (#5693)

view details

Deepak Vishwakarma

commit sha f93180550276bf727f2ce8244eaa5beaa75d7ee8

readme for std/hash (#6139)

view details

Ryan Dahl

commit sha fbf075997c466a50eeaa0e3323bbcdd8be75e454

Increase visibly of CoC (#6152)

view details

Marcos Casagrande

commit sha 26287ef87b2b238e25a1ab44a43cde24eea15bfc

fix: use queueMicrotask instead of setTimeout (#6112)

view details

push time in a month

issue commentdenoland/deno

`deno install xxx.ts` will replace blank spaces in folder names with "%20" which won't run on Windows

Also backslashes are turned into forwardslashes on Linux:

: mkdir 'A\B'
: ls
'A\B'/
: touch 'A\B'/test.ts
: deno install 'A\B'/test.ts 
error: Cannot resolve module "file:///home/syrup/downloads/A/B/test.ts"
: file A\\B/test.ts
A\B/test.ts: empty

deno 1.1.1 v8 8.5.104 typescript 3.9.2

Peybro

comment created time in a month

issue commentdenoland/deno

Starting REPLServer manually

As noted when I shared this gist, this heavily relies on internal behaviour and might break at any release.

kungfooman

comment created time in 2 months

issue commentdenoland/deno

Deno.readAll returning empty Uint8Array possible bug?

The streams are incompatible. This not throwing an exception is a bug that was solved in #6161, which should be part of the next release.

gabrielgrover

comment created time in 2 months

push eventSyrupThinker/deno

Valentin Anger

commit sha a17eb808132eabed92dbb48326702b8c8d114c06

Minor fixes and cleanup

view details

Valentin Anger

commit sha 025574c55444cc8c23c7320ecfa7d8147ed6d30a

Forbid import from data:// modules This is done to prevent modules from being able to proxy forbidden imports through data. This should be replaced with proper origin tracking at a later time.

view details

Valentin Anger

commit sha 58c18d105a5fd6a6d2f784c37d2881f4baf7426f

Mark data imports unstable

view details

Valentin Anger

commit sha f11a0f1f90d588b5f1ad562c17da790cdd5d28f1

Add non-happy test

view details

push time in 2 months

push eventSyrupThinker/deno

Valentin Anger

commit sha 53005e02d8a7fa6ae2e42588d513231b2b9c892c

Minor fixes and cleanup

view details

push time in 2 months

pull request commentdenoland/deno

Add support for importing data url's

It introduces yet another layer to consider and if I'm not mistaken data imports are dependent on location/origin which we currently don't support.

That is correct; we certainly don't want to allow circumventing restrictions by imports like https > data > file or https > data > http.

SyrupThinker

comment created time in 2 months

pull request commentdenoland/deno

Remove control slice from ops

Also pretty wonky. Node and Hyper differ a lot between the runs :/ If we go by master and try one where the references values are close'ish it might be a small improvement. But I wouldn't read into that.

SyrupThinker

comment created time in 2 months

pull request commentdenoland/deno

Remove control slice from ops

Deno.core.dispatch and Deno.core.send haven't been addressed yet. They do the same thing, should one be removed?

SyrupThinker

comment created time in 2 months

Pull request review commentdenoland/deno

Remove control slice from ops

 fn send(       })   }); -  let mut buf_one: ZeroCopyBuf;+  let buf_iter_len = buf_iter.len();++  // Depending on potential errors and the number of args,+  // this array might only be partially initiallized.+  // Manual cleanup required, see below.+  let mut buf_stack: [MaybeUninit<ZeroCopyBuf>; 2] =+    unsafe { MaybeUninit::uninit().assume_init() };

I see, thanks for your explanation. [MaybeUninit::uninit(); 2] wouldn't work yet, but MaybeUninit::uninit_array() would be it (for nightly).

SyrupThinker

comment created time in 2 months

issue closeddenoland/deno

ErrorConstructor.captureStackTrace missing in TypeScript definitions

Example

// test.ts
const error = new Error("Example");
Error.captureStackTrace(error);
throw error;

Expected run result

Successful typecheck and output of

error: Uncaught Error: Example
► file:///tmp/test.ts:2:7

2 Error.captureStackTrace(error);
        ^

    at file:///tmp/test.ts:2:7

(As if the above code were in a file named test.js)

Actual run result

error TS2339: Property 'captureStackTrace' does not exist on type 'ErrorConstructor'.

► file:///tmp/test.ts:2:7

2 Error.captureStackTrace(error);
        ~~~~~~~~~~~~~~~~~

System

> deno --version
deno 0.40.0
v8 8.2.308
typescript 3.8.3

closed time in 2 months

SyrupThinker

push eventSyrupThinker/deno

Valentin Anger

commit sha 9cb4f3919fb6b3fbd2988af3a8ee12a8a11d2f8b

Use SmallVec for stack allocated buffers

view details

push time in 2 months

push eventSyrupThinker/deno

Valentin Anger

commit sha b3ac5c3b0e82ff5ce664f488321fc72b5f1a6cb3

Use SmallVec for stack allocated buffers

view details

push time in 2 months

Pull request review commentdenoland/deno

Remove control slice from ops

 fn send(       })   }); -  let mut buf_one: ZeroCopyBuf;+  let buf_iter_len = buf_iter.len();++  // Depending on potential errors and the number of args,+  // this array might only be partially initiallized.+  // Manual cleanup required, see below.+  let mut buf_stack: [MaybeUninit<ZeroCopyBuf>; 2] =+    unsafe { MaybeUninit::uninit().assume_init() };+  let mut buf_stack_initialized = 0;+  let use_stack = buf_iter_len <= buf_stack.len();+   let mut buf_vec: Vec<ZeroCopyBuf>; -  // Collect all ArrayBufferView's-  let buf_iter_result = match buf_iter.len() {-    0 => Ok(&mut [][..]),-    1 => match buf_iter.next().unwrap() {-      Ok(buf) => {-        buf_one = buf;-        Ok(std::slice::from_mut(&mut buf_one))+  // If response is empty then it's either async op or exception was thrown.+  // In case of an error the arguments are invalid.+  let maybe_response_or_err = {+    // Use a new scope to ensure buf_iter_result lives only as long as its valid.+    // It also needs to be dropped to ensure there aren't two mutable references during cleanup.++    // Collect all ArrayBufferView's+    let buf_iter_result = match buf_iter_len {+      c if use_stack => {+        let mut maybe_err = None;+        for (idx, buf) in buf_iter.enumerate() {+          match buf {+            Ok(buf) => {+              buf_stack[idx] = MaybeUninit::new(buf);+              buf_stack_initialized += 1;+            }+            Err(err) => {+              maybe_err = Some(err);+              break;+            }+          }+        }+        match maybe_err {+          Some(err) => Err(err),+          None => Ok(unsafe {+            // If maybe_err is None, c elements of buf_stack have been initialized,

Agreed, using a library for this is more maintainable and less error prone.

SyrupThinker

comment created time in 2 months

Pull request review commentdenoland/deno

Remove control slice from ops

 fn send(       })   }); -  let mut buf_one: ZeroCopyBuf;+  let buf_iter_len = buf_iter.len();++  // Depending on potential errors and the number of args,+  // this array might only be partially initiallized.+  // Manual cleanup required, see below.+  let mut buf_stack: [MaybeUninit<ZeroCopyBuf>; 2] =+    unsafe { MaybeUninit::uninit().assume_init() };

I'm inclined to believe you on that, but the documentation explicitly provides partially initialized arrays as an example. So I must be doing something wrong; for example maybe taking a slice of the initialized part is invalid for some to me unknown reason? Could you elaborate on that for me so I don't use it the most wrong way again? :)

SyrupThinker

comment created time in 2 months

push eventSyrupThinker/deno

Marcos Casagrande

commit sha a1915a0d4fd7d760c234e209967d842f851628d5

fix(fetch): Support 101 status code (#6059)

view details

timonson

commit sha 9a97e61b78fcec4ac9bb3da3e49afd0a2f849b9a

feat(std/encoding): add base64url module (#5976)

view details

Ryan Dahl

commit sha 041ccb6a0d658a7ba393b2cfe86579b2dc4945b7

Remove dead code (#6066)

view details

David Sherret

commit sha 445e44199b3ce4edb4468176a317aafdaae15517

Update to dprint 0.19.1 and swc_ecma_parser 0.24.3 (#6068)

view details

Ryan Dahl

commit sha a90d9fbd348db922c33f45af834bd3b89574b4a9

fix: dynamic import BorrowMutError (#6065)

view details

Ryan Dahl

commit sha aa39dfc62f8fc88ebb3dfb01fbc979f30557ca9a

upgrade: rusty_v8 0.5.0 (#6070)

view details

Ryan Dahl

commit sha 515d19d901e7e5dbc04670807a2bd1cea237e9e8

v1.0.5

view details

Szalay Kristóf

commit sha 4ef38bad4340b5c8100ec2522264c57f0522aa2d

docs: benchmarking (#6075)

view details

Szalay Kristóf

commit sha cab273476a4ff725d53a8e41bf3f8a90060236d4

fix(std/testing/bench): clock assertions without --allow-hrtime (#6069)

view details

Chris Knight

commit sha 1ebd33092779edc630e8f809f72bcef2656b8185

doc: complete unstable documentation and make consistent (#6074)

view details

matheus

commit sha 94bf551ead0ab5dc922cb61d13b3141896d5a8ae

fix(std/http/file_server): args handling only if invoked directly (#5989)

view details

David Sherret

commit sha fcae2fec879caf26ebe7af17b30a3bce6322b85d

Upgrade to swc_ecma_parser 0.24.5 (#6077)

view details

uki00a

commit sha 9bd5c08d5a2a9cdd2649dd24a4d6b26d9af2a4c4

feat(doc): handle detail output for enum (#6078)

view details

Nayeem Rahman

commit sha 97d876f6db55f5f32ac06155dcb4823e1c636215

fix(std/http): Don't use assert() for user input validation (#6092)

view details

Szalay Kristóf

commit sha 42a04ea08a09e29417518524cbe2245c165e6f55

refactor(std/testing/bench): Remove differentiating on runs count (#6084)

view details

Ryan Dahl

commit sha e3cc3db20fc86d9adb19bb472e8c96ae5f7c77c0

Revert "feat: format deno bundle output (#5139)" (#6085) This reverts commit 93cf3bd5341d5985201ea0905280082d5a3310f9.

view details

Jon Short

commit sha 4b1638dccc601ff0282172c7e3ef0f1126a603ed

feat(std/testing): Allow non-void promises in assertThrowsAsync (#6052)

view details

Matt Dumler

commit sha a04166e9fa87450dfa910afeaf0c1dad988f3988

deno doc docs (#5650)

view details

Yusuke Sakurai

commit sha 430beebc46be1dc87a993c2f7442c5c22076f458

doc: Improved ws example and README (#5636)

view details

skdltmxn

commit sha e05ed537130eff116b48af02d1eb6ce65953e7d8

feat(std/hash): add sha3 (#5558)

view details

push time in 2 months

pull request commentdenoland/deno

Remove control slice from ops

<details>

<summary>Benchmarks</summary>

--- error_001 ---
┌───────┬───────────┬──────────────────────┬───────────────────────┐
│ (idx) │   name    │         mean         │        stddev         │
├───────┼───────────┼──────────────────────┼───────────────────────┤
│   0   │ "stack_0" │ 0.016861711716290324 │ 0.001209008600273871  │
│   1   │ "master"  │ 0.019731050206363634 │ 0.0012051073669040921 │
│   2   │ "stack_1" │ 0.020213051887313434 │ 0.0013331327769872552 │
│   3   │ "stack_3" │ 0.020432211214075627 │ 0.0017623497958508848 │
│   4   │ "stack_2" │ 0.021670581789062487 │ 0.002620364198727666  │
└───────┴───────────┴──────────────────────┴───────────────────────┘
--- text_decoder ---
┌───────┬───────────┬─────────────────────┬──────────────────────┐
│ (idx) │   name    │        mean         │        stddev        │
├───────┼───────────┼─────────────────────┼──────────────────────┤
│   0   │ "stack_2" │ 0.10694174014673916 │ 0.00872960419621517  │
│   1   │ "stack_3" │ 0.1137201812392857  │ 0.031673157672947476 │
│   2   │ "stack_0" │ 0.12616989255500002 │ 0.046129597432469374 │
│   3   │ "master"  │ 0.12869162557862068 │ 0.04715683379998145  │
│   4   │ "stack_1" │ 0.12871970084999998 │ 0.03823356311246889  │
└───────┴───────────┴─────────────────────┴──────────────────────┘
--- text_encoder ---
┌───────┬───────────┬─────────────────────┬──────────────────────┐
│ (idx) │   name    │        mean         │        stddev        │
├───────┼───────────┼─────────────────────┼──────────────────────┤
│   0   │ "stack_1" │ 0.0717044250264706  │ 0.006757405839083842 │
│   1   │ "master"  │ 0.07936682638756758 │ 0.01821966260741203  │
│   2   │ "stack_2" │ 0.08608793195833335 │ 0.02686722169764651  │
│   3   │ "stack_0" │ 0.09973237055499998 │ 0.05343353912971864  │
│   4   │ "stack_3" │ 0.10999774889642855 │  0.0818547558818851  │
└───────┴───────────┴─────────────────────┴──────────────────────┘
--- cold_relative_import ---
┌───────┬───────────┬─────────────────────┬──────────────────────┐
│ (idx) │   name    │        mean         │        stddev        │
├───────┼───────────┼─────────────────────┼──────────────────────┤
│   0   │ "stack_1" │ 0.48369723555000005 │ 0.021724634325360637 │
│   1   │ "master"  │ 0.48557721312000013 │ 0.012963487337691326 │
│   2   │ "stack_0" │ 0.48703590865500007 │  0.0336401666101215  │
│   3   │ "stack_3" │ 0.5827686885250001  │  0.0933026463407021  │
│   4   │ "stack_2" │ 0.6147542190250002  │ 0.30426511396283057  │
└───────┴───────────┴─────────────────────┴──────────────────────┘
--- cold_hello ---
┌───────┬───────────┬────────────────────┬──────────────────────┐
│ (idx) │   name    │        mean        │        stddev        │
├───────┼───────────┼────────────────────┼──────────────────────┤
│   0   │ "stack_2" │   0.475347581525   │ 0.012685799647242006 │
│   1   │ "master"  │   0.47537249112    │ 0.013647874221267235 │
│   2   │ "stack_1" │ 0.4932233829500001 │ 0.03118481793084088  │
│   3   │ "stack_3" │ 0.5116719161250001 │ 0.09601342753917451  │
│   4   │ "stack_0" │   0.541078841355   │ 0.08287149799291146  │
└───────┴───────────┴────────────────────┴──────────────────────┘
--- workers_round_robin ---
┌───────┬───────────┬─────────────────────┬──────────────────────┐
│ (idx) │   name    │        mean         │        stddev        │
├───────┼───────────┼─────────────────────┼──────────────────────┤
│   0   │ "stack_0" │ 0.24092560588833334 │ 0.01522774066166062  │
│   1   │ "master"  │ 0.24289162690333335 │ 0.005285363978466811 │
│   2   │ "stack_2" │ 0.24396237395833334 │ 0.00803912282210745  │
│   3   │ "stack_3" │ 0.24751076943409095 │ 0.007318199174590021 │
│   4   │ "stack_1" │ 0.24863461166818182 │ 0.004995343173427268 │
└───────┴───────────┴─────────────────────┴──────────────────────┘
--- relative_import ---
┌───────┬───────────┬──────────────────────┬───────────────────────┐
│ (idx) │   name    │         mean         │        stddev         │
├───────┼───────────┼──────────────────────┼───────────────────────┤
│   0   │ "stack_0" │ 0.01591655601445946  │ 0.002001526030374305  │
│   1   │ "master"  │ 0.01823087436961833  │ 0.001804755798761421  │
│   2   │ "stack_3" │ 0.018383101556007753 │  0.00185009939154322  │
│   3   │ "stack_1" │ 0.01923898110675676  │ 0.0020232794975189867 │
│   4   │ "stack_2" │ 0.019758953217920355 │ 0.002556569904024987  │
└───────┴───────────┴──────────────────────┴───────────────────────┘
--- workers_startup ---
┌───────┬───────────┬────────────────────┬──────────────────────┐
│ (idx) │   name    │        mean        │        stddev        │
├───────┼───────────┼────────────────────┼──────────────────────┤
│   0   │ "stack_2" │   0.566072217325   │ 0.019350146350982325 │
│   1   │ "stack_0" │   0.586667706155   │ 0.10281441044382549  │
│   2   │ "stack_3" │ 0.5979343384250001 │ 0.15339802273211597  │
│   3   │ "master"  │ 0.6104044733199999 │ 0.06354807826800431  │
│   4   │ "stack_1" │ 0.6152848146500001 │ 0.05693548775843995  │
└───────┴───────────┴────────────────────┴──────────────────────┘
--- hello ---
┌───────┬───────────┬──────────────────────┬───────────────────────┐
│ (idx) │   name    │         mean         │        stddev         │
├───────┼───────────┼──────────────────────┼───────────────────────┤
│   0   │ "stack_0" │ 0.016802109671666673 │ 0.005694779322814975  │
│   1   │ "master"  │ 0.018582407160277772 │ 0.0021273691289819653 │
│   2   │ "stack_1" │ 0.01880988423655463  │ 0.0018087663755995485 │
│   3   │ "stack_2" │ 0.019302377868478264 │ 0.002097364295183566  │
│   4   │ "stack_3" │ 0.020478759979545468 │ 0.005190708798191717  │
└───────┴───────────┴──────────────────────┴───────────────────────┘
--- deno_tcp ---
┌───────┬───────────┬─────────────┬─────────────┐
│ (idx) │   name    │ req_per_sec │ max_latency │
├───────┼───────────┼─────────────┼─────────────┤
│   0   │ "stack_0" │    49894    │     0.4     │
│   1   │ "stack_1" │    49110    │    0.417    │
│   2   │ "stack_2" │    48607    │    0.427    │
│   3   │ "master"  │    47888    │    0.454    │
│   4   │ "stack_3" │    42108    │    0.522    │
└───────┴───────────┴─────────────┴─────────────┘
--- deno_core_http_bench ---
┌───────┬───────────┬─────────────┬─────────────┐
│ (idx) │   name    │ req_per_sec │ max_latency │
├───────┼───────────┼─────────────┼─────────────┤
│   0   │ "stack_2" │    56210    │    0.314    │
│   1   │ "master"  │    56062    │    0.325    │
│   2   │ "stack_1" │    55442    │    0.314    │
│   3   │ "stack_0" │    49543    │    0.409    │
│   4   │ "stack_3" │    47874    │    0.396    │
└───────┴───────────┴─────────────┴─────────────┘
--- node_proxy_tcp ---
┌───────┬───────────┬─────────────┬─────────────┐
│ (idx) │   name    │ req_per_sec │ max_latency │
├───────┼───────────┼─────────────┼─────────────┤
│   0   │ "stack_0" │    22037    │    0.764    │
│   1   │ "stack_1" │    21096    │    0.803    │
│   2   │ "stack_2" │    20913    │    0.804    │
│   3   │ "master"  │    20575    │    0.835    │
│   4   │ "stack_3" │    19327    │    1.05     │
└───────┴───────────┴─────────────┴─────────────┘
--- deno_proxy_tcp ---
┌───────┬───────────┬─────────────┬─────────────┐
│ (idx) │   name    │ req_per_sec │ max_latency │
├───────┼───────────┼─────────────┼─────────────┤
│   0   │ "stack_2" │    19043    │    0.88     │
│   1   │ "stack_0" │    18804    │    0.89     │
│   2   │ "master"  │    18443    │    0.92     │
│   3   │ "stack_1" │    17957    │    1.01     │
│   4   │ "stack_3" │    17008    │    1.32     │
└───────┴───────────┴─────────────┴─────────────┘
--- hyper ---
┌───────┬───────────┬─────────────┬─────────────┐
│ (idx) │   name    │ req_per_sec │ max_latency │
├───────┼───────────┼─────────────┼─────────────┤
│   0   │ "stack_3" │    59028    │    0.238    │
│   1   │ "stack_2" │    58759    │    0.272    │
│   2   │ "master"  │    58169    │    0.284    │
│   3   │ "stack_0" │    58123    │    0.308    │
│   4   │ "stack_1" │    57202    │    0.311    │
└───────┴───────────┴─────────────┴─────────────┘
--- node_tcp ---
┌───────┬───────────┬─────────────┬─────────────┐
│ (idx) │   name    │ req_per_sec │ max_latency │
├───────┼───────────┼─────────────┼─────────────┤
│   0   │ "stack_2" │    60537    │    0.348    │
│   1   │ "stack_0" │    60196    │    0.352    │
│   2   │ "stack_1" │    58752    │    0.393    │
│   3   │ "master"  │    57119    │    0.424    │
│   4   │ "stack_3" │    57007    │    0.471    │
└───────┴───────────┴─────────────┴─────────────┘
--- deno_http ---
┌───────┬───────────┬─────────────┬─────────────┐
│ (idx) │   name    │ req_per_sec │ max_latency │
├───────┼───────────┼─────────────┼─────────────┤
│   0   │ "master"  │    22315    │    0.97     │
│   1   │ "stack_2" │    21208    │    1.84     │
│   2   │ "stack_1" │    21152    │    1.08     │
│   3   │ "stack_0" │    21024    │    1.07     │
│   4   │ "stack_3" │    18523    │    1.18     │
└───────┴───────────┴─────────────┴─────────────┘
--- node_http ---
┌───────┬───────────┬─────────────┬─────────────┐
│ (idx) │   name    │ req_per_sec │ max_latency │
├───────┼───────────┼─────────────┼─────────────┤
│   0   │ "stack_0" │    34326    │    0.688    │
│   1   │ "stack_1" │    34208    │    0.796    │
│   2   │ "master"  │    33735    │    0.775    │
│   3   │ "stack_2" │    31879    │    0.846    │
│   4   │ "stack_3" │    28429    │    0.93     │
└───────┴───────────┴─────────────┴─────────────┘
--- node_proxy ---
┌───────┬───────────┬─────────────┬─────────────┐
│ (idx) │   name    │ req_per_sec │ max_latency │
├───────┼───────────┼─────────────┼─────────────┤
│   0   │ "stack_0" │    3675     │    4.86     │
│   1   │ "stack_1" │    3661     │    4.88     │
│   2   │ "master"  │    3656     │    5.01     │
│   3   │ "stack_2" │    3624     │    5.37     │
│   4   │ "stack_3" │    3140     │    6.25     │
└───────┴───────────┴─────────────┴─────────────┘
--- error_001 ---
┌───────┬───────────┬────────────┐
│ (idx) │   name    │ max_memory │
├───────┼───────────┼────────────┤
│   0   │ "stack_1" │  23080960  │
│   1   │ "stack_3" │  23085056  │
│   2   │ "stack_0" │  23121920  │
│   3   │ "stack_2" │  23138304  │
│   4   │ "master"  │  23670784  │
└───────┴───────────┴────────────┘
--- text_decoder ---
┌───────┬───────────┬────────────┐
│ (idx) │   name    │ max_memory │
├───────┼───────────┼────────────┤
│   0   │ "stack_2" │  27475968  │
│   1   │ "stack_3" │  27492352  │
│   2   │ "master"  │  27570176  │
│   3   │ "stack_1" │  27713536  │
│   4   │ "stack_0" │  27869184  │
└───────┴───────────┴────────────┘
--- text_encoder ---
┌───────┬───────────┬────────────┐
│ (idx) │   name    │ max_memory │
├───────┼───────────┼────────────┤
│   0   │ "stack_1" │  33079296  │
│   1   │ "master"  │  33181696  │
│   2   │ "stack_0" │  33296384  │
│   3   │ "stack_2" │  33824768  │
│   4   │ "stack_3" │  33869824  │
└───────┴───────────┴────────────┘
--- cold_relative_import ---
┌───────┬───────────┬────────────┐
│ (idx) │   name    │ max_memory │
├───────┼───────────┼────────────┤
│   0   │ "stack_2" │  79745024  │
│   1   │ "stack_0" │  79880192  │
│   2   │ "stack_3" │  80650240  │
│   3   │ "stack_1" │  81059840  │
│   4   │ "master"  │  81805312  │
└───────┴───────────┴────────────┘
--- cold_hello ---
┌───────┬───────────┬────────────┐
│ (idx) │   name    │ max_memory │
├───────┼───────────┼────────────┤
│   0   │ "stack_0" │  78282752  │
│   1   │ "stack_1" │  78684160  │
│   2   │ "stack_2" │  80023552  │
│   3   │ "master"  │  80080896  │
│   4   │ "stack_3" │  80740352  │
└───────┴───────────┴────────────┘
--- workers_round_robin ---
┌───────┬───────────┬────────────┐
│ (idx) │   name    │ max_memory │
├───────┼───────────┼────────────┤
│   0   │ "master"  │  46473216  │
│   1   │ "stack_3" │  46759936  │
│   2   │ "stack_0" │  46952448  │
│   3   │ "stack_1" │  47005696  │
│   4   │ "stack_2" │  47120384  │
└───────┴───────────┴────────────┘
--- relative_import ---
┌───────┬───────────┬────────────┐
│ (idx) │   name    │ max_memory │
├───────┼───────────┼────────────┤
│   0   │ "stack_1" │  23080960  │
│   1   │ "stack_3" │  23085056  │
│   2   │ "stack_0" │  23121920  │
│   3   │ "stack_2" │  23138304  │
│   4   │ "master"  │  23670784  │
└───────┴───────────┴────────────┘
--- workers_startup ---
┌───────┬───────────┬────────────┐
│ (idx) │   name    │ max_memory │
├───────┼───────────┼────────────┤
│   0   │ "stack_1" │ 207949824  │
│   1   │ "stack_0" │ 208015360  │
│   2   │ "stack_2" │ 208101376  │
│   3   │ "master"  │ 208347136  │
│   4   │ "stack_3" │ 208424960  │
└───────┴───────────┴────────────┘
--- hello ---
┌───────┬───────────┬────────────┐
│ (idx) │   name    │ max_memory │
├───────┼───────────┼────────────┤
│   0   │ "master"  │  22450176  │
│   1   │ "stack_0" │  22552576  │
│   2   │ "stack_1" │  22679552  │
│   3   │ "stack_2" │  22769664  │
│   4   │ "stack_3" │  22978560  │
└───────┴───────────┴────────────┘

</details>

<details>

<summary>zero_copy length counts for different programs</summary>

Fetch remote images and store them to disk

Initial fetch

┌─────────────────────────┬───┬─────┬──────┬───┬────────────┐
│          (idx)          │ 0 │  1  │  2   │ 3 │   Values   │
├─────────────────────────┼───┼─────┼──────┼───┼────────────┤
│      zeroCopyCount      │ 0 │ 142 │ 1909 │ 0 │           │
└─────────────────────────┴───┴─────┴──────┴───┴───────────┘
│      zeroCopyCount      │ 0 │ 338 │ 8646 │ 0 │            │
└─────────────────────────┴───┴─────┴──────┴───┴────────────┘

Check for new images to fetch (none added)

┌─────────────────────────┬───┬─────┬──────┬───┬───────────┐
│          (idx)          │ 0 │  1  │  2   │ 3 │  Values   │
├─────────────────────────┼───┼─────┼──────┼───┼───────────┤
│      zeroCopyCount      │ 0 │ 142 │ 1909 │ 0 │           │
└─────────────────────────┴───┴─────┴──────┴───┴───────────┘
│      zeroCopyCount      │ 0 │ 242 │ 3394 │ 0 │           │
└─────────────────────────┴───┴─────┴──────┴───┴───────────┘

Single fetch and display processed data

┌─────────────────────────┬───┬───┬────┬───┬────────┐
│          (idx)          │ 0 │ 1 │ 2  │ 3 │ Values │
├─────────────────────────┼───┼───┼────┼───┼────────┤
│      zeroCopyCount      │ 0 │ 3 │ 11 │ 0 │        │
└─────────────────────────┴───┴───┴────┴───┴────────┘

Oak's getting started returning JSON.stringify(Deno.metrics()) as the body

After several requests.

┌─────────────────────────┬───┬────┬────┬───┬────────┐
│          (idx)          │ 0 │ 1  │ 2  │ 3 │ Values │
├─────────────────────────┼───┼────┼────┼───┼────────┤
│      zeroCopyCount      │ 0 │ 16 │ 13 │ 0 │        │
└─────────────────────────┴───┴────┴────┴───┴────────┘

The script that generated the benchmark tables

┌─────────────────────────┬───┬────┬────┬───┬────────┐
│          (idx)          │ 0 │ 1  │ 2  │ 3 │ Values │
├─────────────────────────┼───┼────┼────┼───┼────────┤
│      zeroCopyCount      │ 0 │ 12 │ 20 │ 0 │        │
└─────────────────────────┴───┴────┴────┴───┴────────┘

</details>

There is no obvious performance impact in the synthetic benchmarks. Although if someone could do the benchmark on a dedicated system to reduce noise that would be great.

Stack allocation should be done for at least 2 buffers because those are predominant in IO heavy tasks. I think this value should be revisited at a later time when the plug-in ecosystem can be taken into consideration.

SyrupThinker

comment created time in 2 months

pull request commentdenoland/deno

Remove control slice from ops

do you have any ideas about the perf impact?

I think the benchmarks should go together with frequency analysis; I'll probably do that later today or tomorrow.

SyrupThinker

comment created time in 2 months

Pull request review commentdenoland/deno

Remove control slice from ops

 declare namespace Deno {     opsCompletedSync: number;     opsCompletedAsync: number;     opsCompletedAsyncUnref: number;-    bytesSentControl: number;-    bytesSentData: number;+    bytesSent: number;

I agree that it should probably be bytesSentControl = zero_copy[0].len() and bytesSentData = <rest> then. Adding bytesSent does not seem useful enough in that case; should I just leave it out?

SyrupThinker

comment created time in 2 months

push eventSyrupThinker/deno

Bartek Iwańczuk

commit sha 9c59a4b18c0aac3699d210c1f05f152651ddca28

v1.0.4

view details

Ryan Dahl

commit sha b7b6e0674f5bd6fed3e9b7ae5f32f95f1784753b

Remove unused check-only feature (#6035)

view details

Ryan Dahl

commit sha 23dc9c13db110d25df22fb9813910b8d9a278953

Fix REPL BorrowMutError panic (#6055)

view details

Szalay Kristóf

commit sha 1db98f10b804129d965daa18de6d528e592a3c0f

feat(std/testing): benching progress callback (#5941)

view details

Nayeem Rahman

commit sha aaa2ed5a6450572d90fdb3fc2f0000759599d46f

fix(std/testing/asserts): Format values in assertArrayContains() (#6060)

view details

Valentin Anger

commit sha 81a9c7de3048dab4aa8ad14b30da590f8ea0c831

Remove control slice from ops

view details

Valentin Anger

commit sha 91d8c2206f3ae97f4fcdbe410ff2f476af503ac9

Merge control and data bytes metrics

view details

Valentin Anger

commit sha ff64a87de329ad343da2456a1980f955a5b4c689

Refactor stack allocation in bindings::send

view details

Valentin Anger

commit sha 621e86a862cbb934f76d78adf2ca666fb7243d81

Update dispatch tests for new control paths

view details

push time in 2 months

issue commentdenoland/deno

thread 'main' panicked at 'already borrowed: BorrowMutError'

@ry

// a.js
await import(new URL("./b.js", import.meta.url).toString());
const conn = Deno.connect({hostname: "localhost", port: 8080});
// b.js
// (empty)
denjucks

comment created time in 2 months

PR opened denoland/deno

Remove control slice from ops

Observation

The control slice is special cased in the dispatch interface despite it being treated similar to zero copy buffers internally.

Does the interface benefit from this distinction, or should it be removed for simplicity?


Points that need to be addressed in the implementation of this PR

  • The DenoCore interface now has two identical functions dispatch and send One could be removed, if at all.
  • Is the distinction of control and data bytes still appropriate for the Metrics, this PR currently merges them. This changes the stable public interface, so it might be undesired.
  • How many ZeroCopyBufs should be stack allocated? I'm currently planning on measuring the frequency of buffer counts for different workloads to determine this.
+144 -173

0 comment

20 changed files

pr created time in 2 months

create barnchSyrupThinker/deno

branch : remove_control_slice

created branch time in 2 months

issue closeddenoland/deno

Allow ops to take several zero copy buffers as arguments

Problem

Currently a op can only optionally take one zero copy buffer. Because of this multiple buffers need to be merged into one to pass them to Rust, forcing several copies. (This could also be done by preserving data between calls, which can be considered an even worse solution)

function sign_a(secret: Uint8Array, data: Uint8Array) {
  const single_buffer = /* Copy secret and data into single_buffer */;
  return sign_op.dispatch(new Uint8Array([...]), single_buffer);
}
fn sign_op(control: &[u8], zero_copy: Option<ZeroCopyBuf>) -> CoreOp {
  // Split zero_copy into secret and data
  return Op::Sync(somemodule::sign(secret, data) /* => Box<[u8]> */);
}

Proposal

Allow ops to take several zero copy buffers as arguments. This eliminates the copies and makes the plugin API easier to use for multi-buffer inputs.

function sign_a(secret: Uint8Array, data: Uint8Array) {
  return sign_op.dispatch(new Uint8Array([...]), secret, data);
}
fn sign_op(control: &[u8], zero_copy: Box<[ZeroCopyBuf]>) -> CoreOp {
  if (zero_copy.len() != 2) {
    return; // Signal error
  }
  // Handle control ...
  return Op::Sync(somemodule::sign(zero_copy[0], zero_copy[1]) /* => Box<[u8]> */);
}

closed time in 2 months

SyrupThinker

issue commentdenoland/deno

Allow ops to take several zero copy buffers as arguments

Resolved with becbb56b19e96e4dd72b861217a855fba953d290

SyrupThinker

comment created time in 2 months

delete branch SyrupThinker/deno

delete branch : zero_copy_slice

delete time in 2 months

push eventSyrupThinker/deno

Valentin Anger

commit sha 4561605796c5cc99d9bc930cd1360b7b9a990a57

Replace length check panics with asserts

view details

Valentin Anger

commit sha fb910fc3e7aaf3b452015600ff29c0055e119c00

Add tests for multiple zero copy buffers

view details

push time in 2 months

pull request commentdenoland/deno

Ops can take several zero copy buffers (#4786)

Is a good example http server / body in a single op?

I'm not sure what you mean

SyrupThinker

comment created time in 2 months

push eventSyrupThinker/deno

Valentin Anger

commit sha bdac375faebafeac13246262d764e3dbefd814d0

Test multiple zero copy buffers in test_plugin

view details

push time in 2 months

push eventSyrupThinker/deno

Valentin Anger

commit sha 7b1ad4599d66dc360eb07e9452b5d1cccfc7a168

Replace length check panics with asserts

view details

Valentin Anger

commit sha b30d2670833962e793913111c9ceafba79fbc77c

Test multiple zero copy buffers in test_plugin

view details

push time in 2 months

pull request commentdenoland/deno

Ops can take several zero copy buffers (#4786)

In general this looks good and I'm in favor of landing. However I don't see any tests which exercise multiple zero copy buffers being used... or have I missed it?

No you didn't miss it. Where would I add this test? I have changed the one in test_plugin, is there another place where I should add one?

SyrupThinker

comment created time in 2 months

CommitCommentEvent

push eventSyrupThinker/deno

Valentin Anger

commit sha bc9f4468c31c16a3c83bcb577ff523868c2508c3

Refactor buffer collection in bindings::send Co-authored-by: Bert Belder <bertbelder@gmail.com>

view details

push time in 2 months

pull request commentdenoland/deno

Ops can take several zero copy buffers (#4786)

.collect::<Result<Vec<_>, _>>() should automatically do what your error filtering logic does. Just curious - was it not working for you? Too obscure?

Huh, I had dismissed that as a typo (: . Its noted in the last example of collect, that is quite obscure.

SyrupThinker

comment created time in 2 months

push eventSyrupThinker/deno

Valentin Anger

commit sha f05d4a627ae8aee330028d9e0baf5e598d645e39

Refactor buffer collection in bindings::send Co-authored-by: Bert Belder <bertbelder@gmail.com>

view details

push time in 2 months

issue commentdenoland/deno

Deno error pure js file

Reproducible on Linux with Deno v1.0.3. The same example works with Deno v1.0.2.

This regressed with ad6d2a7734aafb4a64837abc6abd1d1d0fb20017 (determined with git bisect).

sefel

comment created time in 2 months

more