helloadhavan/github_issues huggingface dataset:
Repository: electron/electron
Pull request: fix: crash on `window.close()` with `webContents` on blur

Backport of #47933

See that PR for details.


Notes: Fixed a crash when calling some `webContents` functions after `window.close()`.


Changed files:
filename: shell/browser/api/electron_api_web_contents.cc
patch: @@ -2747,35 +2747,42 @@ void WebContents::CloseDevTools() {
   if (type_ == Type::kRemote)
     return;
 
-  DCHECK(inspectable_web_contents_);
-  inspectable_web_contents_->CloseDevTools();
+  if (inspectable_web_contents_)
+    inspectable_web_contents_->CloseDevTools();
 }
 
 bool WebContents::IsDevToolsOpened() {
   if (type_ == Type::kRemote)
     return false;
 
-  DCHECK(inspectable_web_contents_);
+  if (!inspectable_web_contents_)
+    return false;
+
   return inspectable_web_contents_->IsDevToolsViewShowing();
 }
 
 std::u16string WebContents::GetDevToolsTitle() {
   if (type_ == Type::kRemote)
     return {};
 
-  DCHECK(inspectable_web_contents_);
+  if (!inspectable_web_contents_)
+    return {};
+
   return inspectable_web_contents_->GetDevToolsTitle();
 }
 
 void WebContents::SetDevToolsTitle(const std::u16string& title) {
-  inspectable_web_contents_->SetDevToolsTitle(title);
+  if (inspectable_web_contents_)
+    inspectable_web_contents_->SetDevToolsTitle(title);
 }
 
 bool WebContents::IsDevToolsFocused() {
   if (type_ == Type::kRemote)
     return false;
 
-  DCHECK(inspectable_web_contents_);
+  if (!inspectable_web_contents_)
+    return false;
+
   return inspectable_web_contents_->GetView()->IsDevToolsViewFocused();
 }
 
@@ -2823,10 +2830,9 @@ void WebContents::InspectElement(int x, int y) {
   if (type_ == Type::kRemote)
     return;
 
-  if (!enable_devtools_)
+  if (!enable_devtools_ || !inspectable_web_contents_)
     return;
 
-  DCHECK(inspectable_web_contents_);
   if (!inspectable_web_contents_->GetDevToolsWebContents())
     OpenDevTools(nullptr);
   inspectable_web_contents_->InspectElement(x, y);

filename: spec/api-web-contents-view-spec.ts
patch: @@ -167,6 +167,26 @@ describe('WebContentsView', () => {
     });
   });
 
+  it('does not crash when closed via window.close()', async () => {
+    const bw = new BrowserWindow();
+    const wcv = new WebContentsView();
+
+    await bw.loadURL('data:text/html,<h1>Main Window</h1>');
+    bw.contentView.addChildView(wcv);
+
+    const dto = new Promise<boolean>((resolve) => {
+      wcv.webContents.on('blur', () => {
+        const devToolsOpen = wcv.webContents.isDevToolsOpened();
+        resolve(devToolsOpen);
+      });
+    });
+
+    wcv.webContents.loadURL('data:text/html,<script>window.close()</script>');
+
+    const open = await dto;
+    expect(open).to.be.false();
+  });
+
   it('can be fullscreened', async () => {
     const w = new BaseWindow();
     const v = new WebContentsView();
Repository: facebook/react
Pull request: [compiler] Fix busted postinstall script


postinstall also runs on consumers of the npm package (not just this repo), so remove it and inline into where it's needed
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/31147).
* #31148
* __->__ #31147

Changed files:
filename: compiler/packages/babel-plugin-react-compiler/package.json
patch: @@ -8,9 +8,8 @@
     "dist"
   ],
   "scripts": {
-    "postinstall": "./scripts/link-react-compiler-runtime.sh",
     "build": "rimraf dist && rollup --config --bundleConfigAsCjs",
-    "test": "yarn snap:ci",
+    "test": "./scripts/link-react-compiler-runtime.sh && yarn snap:ci",
     "jest": "yarn build && ts-node node_modules/.bin/jest",
     "snap": "node ../snap/dist/main.js",
     "snap:build": "yarn workspace snap run build",
Repository: electron/electron
Pull request: fix: crash on `window.close()` with `webContents` on blur

Backport of #47933

See that PR for details.


Notes: Fixed a crash when calling some `webContents` functions after `window.close()`.


Changed files:
filename: shell/browser/api/electron_api_web_contents.cc
patch: @@ -2760,35 +2760,42 @@ void WebContents::CloseDevTools() {
   if (type_ == Type::kRemote)
     return;
 
-  DCHECK(inspectable_web_contents_);
-  inspectable_web_contents_->CloseDevTools();
+  if (inspectable_web_contents_)
+    inspectable_web_contents_->CloseDevTools();
 }
 
 bool WebContents::IsDevToolsOpened() {
   if (type_ == Type::kRemote)
     return false;
 
-  DCHECK(inspectable_web_contents_);
+  if (!inspectable_web_contents_)
+    return false;
+
   return inspectable_web_contents_->IsDevToolsViewShowing();
 }
 
 std::u16string WebContents::GetDevToolsTitle() {
   if (type_ == Type::kRemote)
     return {};
 
-  DCHECK(inspectable_web_contents_);
+  if (!inspectable_web_contents_)
+    return {};
+
   return inspectable_web_contents_->GetDevToolsTitle();
 }
 
 void WebContents::SetDevToolsTitle(const std::u16string& title) {
-  inspectable_web_contents_->SetDevToolsTitle(title);
+  if (inspectable_web_contents_)
+    inspectable_web_contents_->SetDevToolsTitle(title);
 }
 
 bool WebContents::IsDevToolsFocused() {
   if (type_ == Type::kRemote)
     return false;
 
-  DCHECK(inspectable_web_contents_);
+  if (!inspectable_web_contents_)
+    return false;
+
   return inspectable_web_contents_->GetView()->IsDevToolsViewFocused();
 }
 
@@ -2836,10 +2843,9 @@ void WebContents::InspectElement(int x, int y) {
   if (type_ == Type::kRemote)
     return;
 
-  if (!enable_devtools_)
+  if (!enable_devtools_ || !inspectable_web_contents_)
     return;
 
-  DCHECK(inspectable_web_contents_);
   if (!inspectable_web_contents_->GetDevToolsWebContents())
     OpenDevTools(nullptr);
   inspectable_web_contents_->InspectElement(x, y);

filename: spec/api-web-contents-view-spec.ts
patch: @@ -167,6 +167,26 @@ describe('WebContentsView', () => {
     });
   });
 
+  it('does not crash when closed via window.close()', async () => {
+    const bw = new BrowserWindow();
+    const wcv = new WebContentsView();
+
+    await bw.loadURL('data:text/html,<h1>Main Window</h1>');
+    bw.contentView.addChildView(wcv);
+
+    const dto = new Promise<boolean>((resolve) => {
+      wcv.webContents.on('blur', () => {
+        const devToolsOpen = wcv.webContents.isDevToolsOpened();
+        resolve(devToolsOpen);
+      });
+    });
+
+    wcv.webContents.loadURL('data:text/html,<script>window.close()</script>');
+
+    const open = await dto;
+    expect(open).to.be.false();
+  });
+
   it('can be fullscreened', async () => {
     const w = new BaseWindow();
     const v = new WebContentsView();
Repository: ggml-org/llama.cpp
Pull request: context : fix reserve token padding to n_seqs

fix #18532

We pad the `n_tokens` up -> we need to do the same for the outputs.

Changed files:
filename: src/llama-context.cpp
patch: @@ -1458,7 +1458,7 @@ ggml_cgraph * llama_context::graph_reserve(
 
     if (n_tokens % n_seqs != 0) {
         n_tokens = ((n_tokens + (n_seqs - 1)) / n_seqs) * n_seqs; // round to next multiple of n_seqs
-        n_outputs = std::min(n_outputs, n_tokens);
+        n_outputs = std::max(n_outputs, n_tokens);
 
         LLAMA_LOG_DEBUG("%s: making n_tokens a multiple of n_seqs - n_tokens = %u, n_seqs = %u, n_outputs = %u\n", __func__, n_tokens, n_seqs, n_outputs);
     }
Repository: ggml-org/llama.cpp
Pull request: CUDA: only allocate FA tmp buffer if needed

Follow-up to https://github.com/ggml-org/llama.cpp/pull/18559 .

I noticed that the allocation of the fixup buffer can be optimized out entirely unless a stream-k decomposition with fractional tiles is actually being used.

Changed files:
filename: ggml/src/ggml-cuda/fattn-common.cuh
patch: @@ -918,7 +918,9 @@ void launch_fattn(
         blocks_num.y = 1;
         blocks_num.z = 1;
 
-        dst_tmp_meta.alloc(((size_t) blocks_num.x) * ncols * (2 + DV/2));
+        if (ntiles_total % blocks_num.x != 0) { // Fixup is only needed if the SMs work on fractional tiles.
+            dst_tmp_meta.alloc((size_t(blocks_num.x) * ncols * (2 + DV/2)));
+        }
     } else {
         const int ntiles_KQ = (K->ne[1] + nbatch_fa - 1) / nbatch_fa; // Max. number of parallel blocks limited by tensor size.
Repository: vercel/next.js
Pull request: [turbopack] Try to fix v8 crashes on github actions

Hopefully fix v8 crashes like: https://github.com/vercel/next.js/actions/runs/18658418940/job/53193170376  based on discussions on https://github.com/nodejs/node/issues/51555




Closes PACK-5718

Changed files:
filename: turbopack/crates/turbopack-tracing/tests/node-file-trace.rs
patch: @@ -590,6 +590,10 @@ async fn exec_node(directory: &str, path: &str) -> Result<CommandOutput> {
     let dir = f.parent().unwrap();
     println!("[CWD]: {}", dir.display());
 
+    // See https://github.com/nodejs/node/issues/51555
+    // The compile cache is causing flaky crashes when run on github actions.
+    cmd.env("DISABLE_V8_COMPILE_CACHE", "1");
+
     if path.contains("mdx") {
         cmd.arg("--experimental-loader=@mdx-js/node-loader")
             .arg("--no-warnings");
Repository: nodejs/node
Pull request: src: ensure primordials are initialized exactly once

Right now `InitializePrimordials` is invoked twice on a context created via `node::NewContext`: 
1. `InitializeMainContextForSnapshot` invokes `InitializePrimordials`.
2. `InitializePrimordials` invokes `GetPerContextExports` unconditionally.
    1. `GetPerContextExports` invokes `InitializePrimordials` when `node:per_context_binding_exports` private was not set.
        1. `InitializePrimordials` invokes `GetPerContextExports` and initialize primordials for the first time.
    2. Initialize primordials for the second time.

`GetPerContextExports` will be invoked during `node_mksnapshot` by [initializing the principal realm](https://github.com/nodejs/node/blob/38390e5f28043146391d61d9b899b47aa72f53f9/src/node_realm.cc#L48) so it is safe to remove invocation of `InitializePrimordials` in `InitializeMainContextForSnapshot`.

This patch ensures that `InitializePrimordials` is only invoked in `GetPerContextExports` and checks that primordials on the private per-context exports object are not initialized before.

Changed files:
filename: src/api/environment.cc
patch: @@ -758,7 +758,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) {
   if (InitializeBaseContextForSnapshot(context).IsNothing()) {
     return Nothing<void>();
   }
-  return InitializePrimordials(context);
+  return JustVoid();
 }
 
 Maybe<void> InitializePrimordials(Local<Context> context) {
@@ -767,13 +767,18 @@ Maybe<void> InitializePrimordials(Local<Context> context) {
   Context::Scope context_scope(context);
   Local<Object> exports;
 
+  if (!GetPerContextExports(context).ToLocal(&exports)) {
+    return Nothing<void>();
+  }
   Local<String> primordials_string =
       FIXED_ONE_BYTE_STRING(isolate, "primordials");
+  // Ensure that `InitializePrimordials` is called exactly once on a given
+  // context.
+  CHECK(!exports->Has(context, primordials_string).FromJust());
 
-  // Create primordials first and make it available to per-context scripts.
   Local<Object> primordials = Object::New(isolate);
+  // Create primordials and make it available to per-context scripts.
   if (primordials->SetPrototypeV2(context, Null(isolate)).IsNothing() ||
-      !GetPerContextExports(context).ToLocal(&exports) ||
       exports->Set(context, primordials_string, primordials).IsNothing()) {
     return Nothing<void>();
   }
Repository: facebook/react
Pull request: [rcr] Publish react-compiler-runtime to npm


Updates our publishing scripts to also publish react-compiler-runtime.


Changed files:
filename: compiler/packages/react-compiler-runtime/README.md
patch: @@ -0,0 +1,5 @@
+# react-compiler-runtime
+
+Backwards compatible shim for runtime APIs used by React Compiler. Primarily meant for React versions prior to 19, but it will also work on > 19.
+
+See also https://github.com/reactwg/react-compiler/discussions/6.

filename: compiler/scripts/release/shared/packages.js
patch: @@ -2,6 +2,7 @@ const PUBLISHABLE_PACKAGES = [
   'babel-plugin-react-compiler',
   'eslint-plugin-react-compiler',
   'react-compiler-healthcheck',
+  'react-compiler-runtime',
 ];
 
 module.exports = {
Repository: ollama/ollama
Pull request: Fix wsl2 status check for nvidia cards


Changed files:
filename: scripts/install.sh
patch: @@ -134,7 +134,7 @@ fi
 # WSL2 only supports GPUs via nvidia passthrough
 # so check for nvidia-smi to determine if GPU is available
 if [ "$IS_WSL2" = true ]; then
-    if available nvidia-smi && [ -z "$(nvidia-smi | grep -o "CUDA Version: [0-9]*\.[0-9]*")" ]; then
+    if available nvidia-smi && [ -n "$(nvidia-smi | grep -o "CUDA Version: [0-9]*\.[0-9]*")" ]; then
         status "Nvidia GPU detected."
     fi
     install_success
Repository: huggingface/transformers
Pull request: speed up loading checkpoints for zero stage 3


Loading checkpoints for model Qwen/Qwen3-Next-80B-A3B-Instruct was very slow

this change brought down checkpoint loading times from 10mins+ to about 1.5mins

the load method is called over 4 million times (123,799 per layer and there are 41 layers). Looping through the state dict (size ~1500) was therefore very slow. This change speed the loading method by avoiding looping through the state dict.

Flagged for review
- model loading (from pretrained, etc): @CyrilVallez
- distributed: @3outeille @ArthurZucker
- Big Model Inference: @SunMarc

Changed files:
filename: src/transformers/integrations/deepspeed.py
patch: @@ -314,13 +314,14 @@ def load(module: nn.Module, state_dict, prefix="", assign_to_params_buffers=Fals
         args = (state_dict, prefix, local_metadata, True, [], [], error_msgs)
         # Parameters of module and children will start with prefix. We can exit early if there are none in this
         # state_dict
-        if is_deepspeed_zero3_enabled() and len([key for key in state_dict if key.startswith(prefix)]) > 0:
+        if is_deepspeed_zero3_enabled():
             import deepspeed
 
             # In sharded models, each shard has only part of the full state_dict, so only gather
             # parameters that are in the current state_dict.
             named_parameters = dict(module.named_parameters(prefix=prefix[:-1], recurse=False))
-            params_to_gather = [named_parameters[k] for k in state_dict if k in named_parameters]
+            params_to_gather = [named_parameters[k] for k in named_parameters if k in state_dict]
+
             if len(params_to_gather) > 0:
                 # because zero3 puts placeholders in model params, this context
                 # manager gathers (unpartitions) the params of the current layer, then loads from
Repository: ollama/ollama
Pull request: Improve install script output on WSL2 and Linux

Fixes:
* Install success not showing on Linux systems with NVIDIA GPUs
* WSL2 showing no GPU detected when the NVIDIA GPU passthrough is available

Changed files:
filename: scripts/install.sh
patch: @@ -35,7 +35,7 @@ esac
 
 KERN=$(uname -r)
 case "$KERN" in
-    *icrosoft*WSL2 | *icrosoft*wsl2) ;;
+    *icrosoft*WSL2 | *icrosoft*wsl2) IS_WSL2=true;;
     *icrosoft) error "Microsoft WSL1 is not currently supported. Please upgrade to WSL2 with 'wsl --set-version <distro> 2'" ;;
     *) ;;
 esac
@@ -131,6 +131,17 @@ if available systemctl; then
     configure_systemd
 fi
 
+# WSL2 only supports GPUs via nvidia passthrough
+# so check for nvidia-smi to determine if GPU is available
+if [ "$IS_WSL2" = true ]; then
+    if available nvidia-smi && [ -z "$(nvidia-smi | grep -o "CUDA Version: [0-9]*\.[0-9]*")" ]; then
+        status "Nvidia GPU detected."
+    fi
+    install_success
+    exit 0
+fi
+
+# Install GPU dependencies on Linux
 if ! available lspci && ! available lshw; then
     warning "Unable to detect NVIDIA/AMD GPU. Install lspci or lshw to automatically detect and install GPU dependencies."
     exit 0
@@ -310,3 +321,4 @@ if command -v nvidia-persistenced > /dev/null 2>&1; then
 fi
 
 status "NVIDIA GPU ready."
+install_success
Repository: ollama/ollama
Pull request: Fix nvidia detection in install script


Changed files:
filename: scripts/install.sh
patch: @@ -153,6 +153,11 @@ check_gpu() {
     esac
 }
 
+if check_gpu nvidia-smi; then
+    status "NVIDIA GPU installed."
+    exit 0
+fi
+
 if ! check_gpu lspci nvidia && ! check_gpu lshw nvidia && ! check_gpu lspci amdgpu && ! check_gpu lshw amdgpu; then
     install_success
     warning "No NVIDIA/AMD GPU detected. Ollama will run in CPU-only mode."
@@ -269,7 +274,7 @@ if ! check_gpu nvidia-smi || [ -z "$(nvidia-smi | grep -o "CUDA Version: [0-9]*\
     esac
 fi
 
-if ! lsmod | grep -q nvidia; then
+if ! lsmod | grep -q nvidia || ! lsmod | grep -q nvidia_uvm; then
     KERNEL_RELEASE="$(uname -r)"
     case $OS_NAME in
         rocky) $SUDO $PACKAGE_MANAGER -y install kernel-devel kernel-headers ;;
@@ -283,10 +288,15 @@ if ! lsmod | grep -q nvidia; then
     if [ -n "$NVIDIA_CUDA_VERSION" ]; then
         $SUDO dkms install $NVIDIA_CUDA_VERSION
     fi
-fi
 
-$SUDO modprobe nvidia
-$SUDO modprobe nvidia_uvm
+    if lsmod | grep -q nouveau; then
+        status 'Reboot to complete NVIDIA CUDA driver install.'
+        exit 0
+    fi
+
+    $SUDO modprobe nvidia
+    $SUDO modprobe nvidia_uvm
+fi
 
 # make sure the NVIDIA modules are loaded on boot with nvidia-persistenced
 if command -v nvidia-persistenced > /dev/null 2>&1; then
@@ -299,9 +309,4 @@ if command -v nvidia-persistenced > /dev/null 2>&1; then
     done
 fi
 
-if lsmod | grep -q nouveau; then
-    status 'Reboot to complete NVIDIA CUDA driver install.'
-    exit 0
-fi
-
 status "NVIDIA GPU ready."
Repository: denoland/deno
Pull request: fix: include Temporal types in deno types output

## Summary

Add `"esnext.temporal"` to the `lib_names` list in `get_types_declaration_file_text()` so that `deno types` emits the Temporal namespace declarations from TypeScript's `lib.esnext.temporal.d.ts`.

This was accidentally removed in #32656 (typescript-go update) which dropped the `"deno.temporal"` entry added by #32571. Since `deno types` does flat concatenation (doesn't follow `/// <reference>` chains), the Temporal types were silently lost from the output, breaking docs generation at docs.deno.com.

Closes #32950

## Test plan

```sh
# Before: no output
deno types | grep "declare namespace Temporal"

# After:
deno types | grep "declare namespace Temporal"
# declare namespace Temporal {
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Changed files:
filename: cli/tsc/mod.rs
patch: @@ -73,6 +73,7 @@ pub fn get_types_declaration_file_text() -> String {
     "deno.net",
     "deno.shared_globals",
     "deno.cache",
+    "esnext.temporal",
     "deno.window",
     "deno.unstable",
   ];
Repository: ollama/ollama
Pull request: Give the final model loading more time

On some systems, 1 minute isn't sufficient to finish the load after it hits 100%

Fixes #4098 #4636 

Changed files:
filename: llm/server.go
patch: @@ -519,11 +519,13 @@ func (s *llmServer) Ping(ctx context.Context) error {
 
 func (s *llmServer) WaitUntilRunning(ctx context.Context) error {
 	start := time.Now()
-	stallDuration := 60 * time.Second
-	stallTimer := time.Now().Add(stallDuration) // give up if we stall for
+	stallDuration := 5 * time.Minute            // If no progress happens
+	finalLoadDuration := 5 * time.Minute        // After we hit 100%, give the runner more time to come online
+	stallTimer := time.Now().Add(stallDuration) // give up if we stall
 
 	slog.Info("waiting for llama runner to start responding")
 	var lastStatus ServerStatus = -1
+	fullyLoaded := false
 
 	for {
 		select {
@@ -572,6 +574,10 @@ func (s *llmServer) WaitUntilRunning(ctx context.Context) error {
 			if priorProgress != s.loadProgress {
 				slog.Debug(fmt.Sprintf("model load progress %0.2f", s.loadProgress))
 				stallTimer = time.Now().Add(stallDuration)
+			} else if !fullyLoaded && int(s.loadProgress*100.0) >= 100 {
+				slog.Debug("model load completed, waiting for server to become available", "status", status.ToString())
+				stallTimer = time.Now().Add(finalLoadDuration)
+				fullyLoaded = true
 			}
 			time.Sleep(time.Millisecond * 250)
 			continue
Repository: vercel/next.js
Pull request: [Cache Components] fix env labels in perf track test

We updated the label for the Runtime stage to `Prefetchable` in #85076, and #85111 wasn't rebased on top of that

Changed files:
filename: test/development/app-dir/react-performance-track/react-performance-track.test.ts
patch: @@ -61,7 +61,7 @@ describe('react-performance-track', () => {
     expect(track).toEqual(
       expect.arrayContaining([
         {
-          name: '\u200bparams [Prefetch]',
+          name: '\u200bparams [Prefetchable]',
           properties: [],
         },
       ])
@@ -80,7 +80,7 @@ describe('react-performance-track', () => {
     expect(track).toEqual(
       expect.arrayContaining([
         {
-          name: '\u200bsearchParams [Prefetch]',
+          name: '\u200bsearchParams [Prefetchable]',
           properties: [],
         },
       ])
@@ -97,7 +97,7 @@ describe('react-performance-track', () => {
     expect(track).toEqual(
       expect.arrayContaining([
         {
-          name: '\u200bcookies [Prefetch]',
+          name: '\u200bcookies [Prefetchable]',
           properties: [],
         },
         // TODO: The error message makes this seem like it shouldn't pop up here.
@@ -123,7 +123,7 @@ describe('react-performance-track', () => {
     })
 
     const track = await browser.eval('window.reactServerRequests.getSnapshot()')
-    // TODO: Should include "draftMode [Prefetch]".
+    // TODO: Should include "draftMode [Prefetchable]".
     expect(track).toEqual([
       {
         name: '\u200b',
@@ -142,7 +142,7 @@ describe('react-performance-track', () => {
     expect(track).toEqual(
       expect.arrayContaining([
         {
-          name: '\u200bheaders [Prefetch]',
+          name: '\u200bheaders [Prefetchable]',
           properties: [],
         },
         // TODO: The error message makes this seem like it shouldn't pop up here.
Repository: nodejs/node
Pull request: dgram: restore buffer optimization in fixBufferList

Restore the Buffer.isBuffer() check to avoid unnecessary Buffer.from() calls when the input is already a Buffer. 
This improves performance buffer-heavy UDP operations.

Includes benchmark test for fixBufferList function to verify the performance improvements across different 
data types and chunk sizes.

Changed files:
filename: benchmark/dgram/send-types.js
patch: @@ -0,0 +1,52 @@
+'use strict';
+
+const common = require('../common.js');
+const dgram = require('dgram');
+const { Buffer } = require('buffer');
+
+const bench = common.createBenchmark(main, {
+  type: ['string', 'buffer', 'mixed', 'typedarray'],
+  chunks: [1, 4, 8, 16],
+  len: [64, 512, 1024],
+  n: [1000],
+});
+
+function main({ type, chunks, len, n }) {
+  const socket = dgram.createSocket('udp4');
+
+  let testData;
+  switch (type) {
+    case 'string':
+      testData = Array(chunks).fill('a'.repeat(len));
+      break;
+    case 'buffer':
+      testData = Array(chunks).fill(Buffer.alloc(len, 'a'));
+      break;
+    case 'mixed':
+      testData = [];
+      for (let i = 0; i < chunks; i++) {
+        if (i % 2 === 0) {
+          testData.push(Buffer.alloc(len, 'a'));
+        } else {
+          testData.push('a'.repeat(len));
+        }
+      }
+      break;
+    case 'typedarray':
+      testData = Array(chunks).fill(new Uint8Array(len).fill(97));
+      break;
+  }
+
+  bench.start();
+
+  for (let i = 0; i < n; i++) {
+    socket.send(testData, 12345, 'localhost', (err) => {
+      if (err && err.code !== 'ENOTCONN' && err.code !== 'ECONNREFUSED') {
+        throw err;
+      }
+    });
+  }
+
+  bench.end(n);
+  socket.close();
+}

filename: lib/dgram.js
patch: @@ -549,6 +549,8 @@ function fixBufferList(list) {
     const buf = list[i];
     if (typeof buf === 'string')
       newlist[i] = Buffer.from(buf);
+    else if (Buffer.isBuffer(buf))
+      newlist[i] = buf;
     else if (!isArrayBufferView(buf))
       return null;
     else