sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: go
Issue: net/textproto: reduce allocations in ReadMIMEHeader
Labels: NeedsDecision

### What version of Go are you using (`go version`)?

<pre>
1.14
</pre>

### What did you do?

For our use-case (a HTTP proxy) `textproto.ReadMIMEHeader` is in the top 3 in term of allocations. In order to ease the GC, we could pre-allocate 512 bytes to be used for small header values. This can reduce by half the number of allocations for this function.

```
name                              old time/op    new time/op    delta
ReadMIMEHeader/client_headers-16    2.30µs ± 5%    2.11µs ± 2%   -8.21%  (p=0.000 n=10+10)
ReadMIMEHeader/server_headers-16    1.94µs ± 3%    1.85µs ± 3%   -4.56%  (p=0.000 n=10+10)

name                              old alloc/op   new alloc/op   delta
ReadMIMEHeader/client_headers-16    1.53kB ± 0%    1.69kB ± 0%  +10.48%  (p=0.000 n=10+10)
ReadMIMEHeader/server_headers-16    1.09kB ± 0%    1.44kB ± 0%  +32.32%  (p=0.000 n=10+10)

name                              old allocs/op  new allocs/op  delta
ReadMIMEHeader/client_headers-16      14.0 ± 0%       6.0 ± 0%  -57.14%  (p=0.000 n=10+10)
ReadMIMEHeader/server_headers-16      14.0 ± 0%       6.0 ± 0%  -57.14%  (p=0.000 n=10+10)
```

The patch is pretty small:

```
index d26e981ae4..6126a6685c 100644
--- a/src/net/textproto/reader.go
+++ b/src/net/textproto/reader.go
@@ -13,6 +13,7 @@ import (
        "strconv"
        "strings"
        "sync"
+       "unsafe"
 )

 // A Reader implements convenience methods for reading requests
@@ -502,6 +503,12 @@ func (r *Reader) ReadMIMEHeader() (MIMEHeader, error) {
                return m, ProtocolError("malformed MIME header initial line: " + string(line))
        }

+       // Create a pre-allocated byte slice for all header values to save
+       // allocations for the first 512 bytes of values, a size that fit typical
+       // small header values, larger ones will get their own allocation.
+       const valuesPreAllocSize = 1 << 9
+       valuesPreAlloc := make([]byte, 0, valuesPreAllocSize)
+
        for {
                kv, err := r.readContinuedLineSlice(mustHaveFieldNameColon)
                if len(kv) == 0 {
@@ -527,7 +534,17 @@ func (r *Reader) ReadMIMEHeader() (MIMEHeader, error) {
                for i < len(kv) && (kv[i] == ' ' || kv[i] == '\t') {
                        i++
                }
-               value := string(kv[i:])
+
+               // Try to fit the value in the pre-allocated buffer to save allocations.
+               var value string
+               if len(kv[i:]) <= valuesPreAllocSize-len(valuesPreAlloc) {
+                       off := len(valuesPreAlloc)
+                       valuesPreAlloc = append(valuesPreAlloc, kv[i:]...)
+                       v := valuesPreAlloc[off:]
+                       value = *(*string)(unsafe.Pointer(&v))
+               } else {
+                       value = string(kv[i:])
+               }

                vv := m[key]
                if vv == nil && len(strs) > 0 {
```

Please tell me if it's worth submitting a PR with this change.
Repository: rust
Issue: Tracking Issue for Read::is_read_vectored/Write::is_write_vectored.
Labels: T-libs-api,B-unstable,C-tracking-issue,A-io,Libs-Tracked,Libs-Small

### Unresolved Questions

- [ ] What's the right naming for these methods?

### Implementation history

* #67841
Repository: flutter
Issue: [Camera] Audio stream
Labels: c: new feature,p: camera,package,team-ecosystem,P3,triaged-ecosystem

`[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.3 19D76, locale en-TW)
    • Flutter version 1.12.13+hotfix.8 at /Users/tonypottera/.flutter_stable
    • Framework revision 0b8abb4724 (4 周前), 2020-02-11 11:44:36 -0800
    • Engine revision e1e6ced81d
    • Dart version 2.7.0`

I'm building a video recording application which needs to show audio amplitudes before, during, and after video recording.

Currently, on iOS, I can use `flutter_sound: ^2.1.1` to record audio, and use `camera: ^0.5.7+4` to capture video without any problem.
However, on Android, `startVideoRecording` will crash if `flutter_sound` is already recording audio.

I'm wondering if there's any way to achieve this goal.
For example, it would be great if `camera` provides `startAudioStream` functionality.
Repository: neovim
Issue: Add flag and environment variable to _not_ touch STDIN
Labels: enhancement

The change to default STDIN handling from #2087 is very welcome, but the current situation leaves a whole set of possible use cases.

Consider a pattern like this:

```
find -type d | while read dir; do (cd $dir && zsh -i); done
```

This is greatly simplified from actual usage and obviously if I was _only_ trying to run Neovim just passing it a list of files would be better, but in cases where other activities need to be done semi-manually, I use this kind of loop frequently to open interactive shells in all the places that need work.

Now if in that shell instance I run `nvim MYFILE`, it will open two buffers, one with whatever was remaining that `while read` hadn't read from STDIN yet, and one with the requested file. This is very obnoxious because it ruins the rest of the pipeline.

A current work around is to only ever launch with `nvim MYFILE < /dev/null` so that the STDIN read by nvim is not any pending parent loop input but an empty one of its own.

It would be nice to be able to set an environment variable or pass a flag of some kind to suppress any attempt to read STDIN.
Repository: svelte
Issue: Event bindings on animate directive
Labels: feature request,temp-stale

It would be nice to be able to bind events on the `animate:*` directive, much like the one that are available with the [transition directive](https://svelte.dev/docs#Transition_events) (`introstart`, `introend,` `outrostart`, `outroend`).

This feature would be useful in order to prevent other changes to the current component state while an animation is occuring, as a component update during an animation can make it glitch.

I think two events named `animstart` and `animend` would be appropriate.

In the meantime, is there a way to emulate this feature with what svelte already offers ?
Repository: rust
Issue: Add in memory object files support to CompiledModule and ArchiveBuilder
Labels: C-enhancement,A-codegen,I-compiletime,T-compiler,A-cranelift

https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/struct.CompiledModule.html

https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/back/archive/trait.ArchiveBuilder.html

rustc_codegen_cranelift can emit object files to memory without writing them to the disk. With the current setup they need to be written to the disk before an rlib can be created. This doubles the amount of data written to the disk compared to emitting the object files to memory and then creating an rlib file from that. Linking a dylib or executable will still need to write the object files to the disk, but at least rlibs don't have to anymore.
Repository: pytorch
Issue: Support creating a CPU tensor from ctypes pointer in Python / from_blob(ptr, shape, strides, dtype)
Labels: module: docs,module: memory usage,triaged,enhancement,module: numpy

NumPy has utilities that allow to create an array from a ctypes pointer in pure Python (without C++ extensions):
- https://docs.scipy.org/doc/numpy/reference/routines.ctypeslib.html#module-numpy.ctypeslib:
  - https://numpy.org/doc/stable/reference/routines.ctypeslib.html#numpy.ctypeslib.as_array
- https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.ctypes.html

In C++ land, it seems that [`torch::from_blob`](https://pytorch.org/cppdocs/api/function_namespacetorch_1ad7fb2a7759ef8c9443b489ddde494787.html#function-documentation) should do the trick, but it has no binding to Python.

I propose to have utilities that would allow to do without passing by NumPy first or creating a C++ extension for a single-function `torch::from_blob` call, i.e. Python binding for `torch::from_blob` (that exist in java bindings btw), potentially with a custom deleter.

Context: I'd like to make a very thin ffmpeg audio-reading wrapper: the C code would do that allocation, return it to calling code, and the calling code would be responsible to free that memory. Pseudocode for NumPy (I still need to fix the C code) is here: https://github.com/vadimkantorov/audioprimer/blob/master/decode_audio.py . Ideally I'll have a single C file that's independent of NumPy/Torch and just slightly different versions of interfacing with it. I can think of some alternatives for this particular case, but Python way of creating a tensor from a raw ctypes pointer still may be useful for existing ctypes codebases.
Repository: opencv
Issue: Feature request: equivalent of moveaxis (Python/Numpy) and permute (MATLAB)
Labels: feature,category: core,effort: few days

References:
https://docs.scipy.org/doc/numpy/reference/generated/numpy.moveaxis.html
https://nl.mathworks.com/help/matlab/ref/permute.html

As far as I know, this operation is not available in OpenCV. About a year ago, someone on Stack Overflow also asked for an easy way to do this, but unfortunately the post remains unanswered.
See https://stackoverflow.com/questions/55117581/how-to-permute-the-axes-on-cvmat-in-c
Repository: godot
Issue: Light2D mask disables CanvasItemMaterial
Labels: bug,topic:rendering

**Godot version:3.2.1**

**OS/device including version: Windows 10 1809**

**Issue description:**
To properly display alphas from a transparent Viewport (Transparent Bg property on), you need to apply a CanvasItemMaterial to the Sprite with *Blend Mode = Premult Alpha*, or your viewport does not display correctly  (colors and opacity gets less intense).

As soon as a Light2D with *Mode = Mask* touches the Sprite, the CanvasItemMaterial seems to disappear.

Visual appearence (thats what is supposed to look like), when the Light2D does not touch the sprite:
![not_touch](https://user-images.githubusercontent.com/20476676/76532001-4a148a00-6476-11ea-9269-f468039f604e.jpg)

Visual appearance when the Light2D touches the sprite:
![touch](https://user-images.githubusercontent.com/20476676/76531921-30734280-6476-11ea-9ef3-62b1cb90bff4.jpg)


**Steps to reproduce:**
Make a viewport with transparent content
Apply viewport-texture to a sprite
Move a Light2D with mode=mask over the sprite


**Minimal reproduction project:**
[test_light_vs_canvasitemmaterial.zip](https://github.com/godotengine/godot/files/4324814/test_light_vs_canvasitemmaterial.zip)
Repository: godot
Issue: incorrect error message: The class couldn't be fully loaded...
Labels: discussion,topic:gdscript

**Godot version:** 3.2.1 stable

**OS/device including version:** Mac OS 10.15.3

**Issue description:** Incorrect error message: `The class "SingleItemClickable" couldn't be fully loaded...`. There's no reason for such error, and game works without any problems

**Steps to reproduce:** Open attached project and open BaseLevel.gd. The error appears at the end of the file. 

**Minimal reproduction project:**
[Lake copy.zip](https://github.com/godotengine/godot/files/4324756/Lake.copy.zip)

Tried to strip the project to bare minimum, that's why it looks weird. I suppose the problem may be with autoloads, so I left the classes there.

This might be a duplicate of https://github.com/godotengine/godot/issues/21461 , but here you have a minimal product that reproduces the bug every time (at least in my case).
Repository: pytorch
Issue: Confusing error message of tensor constructor when passing a storage
Labels: triaged

I tried to use torch.Tensor and pass it a torch.Storage (maybe wrongly) and got this:
```
>>> torch.Tensor(torch.zeros(1, dtype = torch.int16).storage())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Expected object of data type float but got data type 4687170077835386990 for argument #2 'source'
```

Even if this is not allowed, a better error message would make more sense!

Context: I have a storage of various types (can be float32, uint8, int16 etc) and I want to construct a tensor from it without making an if statement. torch.as_tensor doesn't work as well
Repository: pytorch
Issue: Support passing memoryview to torch.as_tensor
Labels: triaged,enhancement

As far as I understand, memoryview python objects support itemsize and shapes, ndim, strides etc:

https://docs.python.org/3/library/stdtypes.html#memoryview :
```python
# from python docs example
import struct
buf = struct.pack("i"*12, *list(range(12)))
x = memoryview(buf)
y = x.cast('i', shape=[2,2,3])
print(y.shape) # (2, 2, 3)

import torch
torch.as_tensor(y)
# ValueError: could not determine the shape of object type 'memoryview'
# kind of funny, because shape exists :0
```
Repository: pytorch
Issue: Add "strict" flag to ignore missing parameters in Optimizer.load_state_dict
Labels: module: optimizer,triaged,enhancement

## 🚀 Feature

Add a `strict` flag to `Optimizer.load_state_dict` to match the interface for `nn.Module.load_state_dict`. This allows the optimizer to ignore missing parameters in the optimizer state. `nn.Module.load_state_dict` already supports this behavior.

## Motivation

Currently, loading optimizer state fails when the new optimizer object has distinct parameters from the saved state. This makes finetuning difficult since I would prefer to load partial optimizer state, e.g. to create new Adam moment estimates for the new layers.

## Pitch

Add a `strict` optional positional argument to `Optimizer.load_state_dict`, so that the signature is `load_state_dict(self, state_dict, strict=True)`.

## Alternatives

The current workaround is to take the newly initialized optimizer state, update this dictionary with the old one, and then call `load_state_dict`.

```
opt = optim.SGD(...)
checkpoint = torch.load(...)
old_opt_state = checkpoint["opt"]
new_opt_state = opt.state_dict()
new_opt_state.update(old_opt_state)
opt.load_state_dict(new_opt_state)
```

(EDIT: the above does not work. It is necessary to update the 'param_group' list in the state dict too. Will update that in a second)

The new code would look like:
```
opt = optim.SGD(...)
checkpoint = torch.load(...)
old_opt_state = checkpoint["opt"]
opt.load_state_dict(old_opt_state, strict=False)
```

cc @vincentqb
Repository: ant-design
Issue: Configurable layout for Upload control
Labels: help wanted,Inactive

- [x] I have searched the [issues](https://github.com/ant-design/ant-design/issues) of this repository and believe that this is not a duplicate.

### What problem does this feature solve?
Permits customizing the render location of the Upload button/dragger separately from file list.

### What does the proposed API look like?
Provide separate controls for file list and Upload button/dragger, so they can be arranged where needed. They can both live under an ancestor Upload.
```
<Upload>
  <MyLayout>
    <Upload.FileList/>
    <Upload.Dragger/>
  </MyLayout>
<Upload>
```


<!-- generated by ant-design-issue-helper. DO NOT REMOVE -->
Repository: flutter
Issue: Flutter stops animations even when screen is only partially obscured
Labels: framework,a: animation,customer: money (g3),P2,team-framework,triaged-framework

See: b/151332834

When showing native bottom sheet or alert dialogs, screen is only partially obscured. If there's an ongoing animation, it stops when the native UI starts displaying leading to jarring effects. See repro:

```dart
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

void main() => runApp(
    MaterialApp(
      home: MyApp(),
      theme: ThemeData(
        splashFactory: InkRipple.splashFactory,
      ),
    )
);

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  _launchURL() async {
    const url = 'tel://9000000';
    if (await canLaunch(url)) {
      // This uses url launcher plugin to display an overlay.
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Flutter"),
      ),
      body: Center(
          child: FlatButton(
            child: Text("A long launch URL"),
            shape: RoundedRectangleBorder(
              side: BorderSide(
                color: Colors.blue,
                width: 1,
              ),
              borderRadius: BorderRadius.all(Radius.circular(24)),
            ),
            onPressed: _launchURL,
          )
      ),
    );
  }
}
```

Video is attached. Ripple gets stuck in the middle when the overlay is shown.

[RPReplay_Final1583912940.mp4.gz](https://github.com/flutter/flutter/files/4325907/RPReplay_Final1583912940.mp4.gz)
Repository: node
Issue: re-enable crypto dh keygen testing on Arm
Labels: crypto,test,arm

A Crypto test has been disabled on AArch64 as part of PR: https://github.com/nodejs/node/pull/31178

After a brief chat with Sam, he suggests a discussion about this should include @tniessen. I would like to discover the root-cause of the poor performance. The build logs for the job have expired for the Arm builds - is there a  record of the hardware that was used for the Arm build?

EDIT: corrected summary.
Repository: go
Issue: x/build/cmd/coordinator: include -longtest and -race builders for trybots on release branches
Labels: Builders,NeedsFix

After a major version of a Go release is out, we send relatively few CLs to the release branch in order to backport fixes for minor releases, per https://golang.org/wiki/MinorReleases policy.

We should consider including -longtest and -race builders in the default tryset (set of builders included in a normal trybot run) for those branches::

- [ ] darwin-amd64-longtest (#35678)
- [x] linux-386-longtest
- [x] linux-amd64-longtest
- [x] linux-arm64-longtest (#49649)
- [x] windows-amd64-longtest
- darwin-amd64-race
- freebsd-amd64-race
- linux-amd64-race
- windows-amd64-race

Those builders already run as post-submit builders, but also running them during trybots will give us more information to work with before a CL is submitted to a release branch.

We may want to do this only for minor releases, i.e., after a major Go release is out. Or we can do this always, which would include CLs sent to a release branch after the first release candidate is made.

An existing alternative is to manually request those builders via [SlowBots](https://golang.org/wiki/SlowBots).

/cc @cagedmantis @toothrot @golang/osp-team
Repository: flutter
Issue: [tool_crash] Invalid argument(s): Cannot find executable for /flutter/bin/cache/artifacts/
Labels: c: crash,tool,P2,team-tool,triaged-tool

## TL;DR Workaround

Wiping out the flutter cache will cause the flutter tool to re-try downloading the required cached artifacts when next invoked, which will usually fix the issue.

```
$ rm -rf <path to flutter installation>/bin/cache
$ flutter run -v# or whatever command you were attempting
```

## Issue

The current caching mechanism in the tool does not guarantee that a cached binary is present before invoking.

## Proposed solution

Rather than directly invoking a binary from the flutter cache using processutils, we should have a method on the cache that first checks for the file's existence, and if it isn't there tries to download it first, then invoke.
Repository: pytorch
Issue: [feature request]Support dilation parameter for unfold2d_* function (slow cpu maxpool2d #28733)
Labels: module: performance,module: nn,triaged,module: mkldnn,module: pooling,function request

## Issue description

@soumith, @VitalyFedyunin, @karimhasebou, I was investigating slow maxpool2d on cpu issue #28733.

I thought I could use the conv2d implementation, but two important functions unfold2d_acc, unfold2d_copy (https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/native/cpu/Unfold2d.cpp) lack of dilation parameters, which are required in maxpool2d. This also leads to slow conv2d with dilation on cpu.

Here is my proposal:
1. Either update the Unfold2d.cpp file by adding dilation parameter, then address the other issues later. This plan involves lots of changes and work, but I can give it a try.

2. Or I just find a temporary solution for maxpool2d, i.e., if without dilation, use conv2d equivalent implementation, if with dilation, remain the current implementation. 

What do you guys think?

## Code example

> import torch
> import time
> import torch.nn as nn
> 
> model = nn.Conv2d(in_channels=16, out_channels=16, kernel_size=3, stride=2, dilation=2)
> net = nn.MaxPool2d(kernel_size=3, stride=2, dilation=2)
> blob = torch.randn(1, 16, 5000, 5000, device='cpu')
> 
> t0 = time.time()
> with torch.no_grad():
>     outputs = model(blob)
> print("PyTorch Conv: {}".format(time.time() - t0))
> 
> t0 = time.time()
> with torch.no_grad():
>     pred = net(blob)
> print("PyTorch MaxPool: {}".format(time.time() - t0))

running time:
with dilation: 
conv2d       2.02s
maxpool2d 2.32s

without dilation:
conv2d      **0.35s**
maxpool2d 2.69s

## System Info
PyTorch version: 1.5.0a0+a22008f
Is debug build: No
CUDA used to build PyTorch: 10.1

OS: Ubuntu 18.04.4 LTS
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
CMake version: version 3.14.0

Python version: 3.7
Is CUDA available: Yes
CUDA runtime version: Could not collect
GPU models and configuration: 
GPU 0: GeForce RTX 2080 Ti
GPU 1: GeForce RTX 2080 Ti

Nvidia driver version: 430.50
cuDNN version: /usr/lib/x86_64-linux-gnu/libcudnn.so.7.6.5

Versions of relevant libraries:
[pip] numpy==1.18.1
[pip] torch==1.5.0a0+a22008f
[conda] blas                      1.0                         mkl  
[conda] magma-cuda101             2.5.2                         1    pytorch
[conda] mkl                       2020.0                      166  
[conda] mkl-include               2020.0                      166  
[conda] mkl-service               2.3.0            py37he904b0f_0  
[conda] mkl_fft                   1.0.15           py37ha843d7b_0  
[conda] mkl_random                1.1.0            py37hd6b4f25_0  
[conda] torch                     1.5.0a0+a22008f          pypi_0    pypi



cc @gujinghui @PenghuiCheng @XiaobingSuper @jianyuh @VitalyFedyunin @albanD @mruberry @ngimel @heitorschueroff
Repository: next.js
Issue: paths get url-encoded with next export and getStaticPaths
Labels: Pages Router

# Bug report

## Describe the bug

Paths get url-encoded when using `next export`. This causes them to get double-encoded when live. 

## To Reproduce

test case: https://gitlab.com/meesvandongen/test-case-next-export

build & export the project, serve it and go to the relevant page:
* [/test/path%20with%20spaces](https://meesvandongen.gitlab.io/test-case-next-export/test/path%20with%20spaces)
  doesn't work
* [/test/path%2520with%2520spaces](https://meesvandongen.gitlab.io/test-case-next-export/test/path%2520with%2520spaces)
  works; because we encoded the percent in `%20` (space), giving `%2520`

## Expected behavior

The routes are exported without encoding.

## Additional context

This behaviour is different from exportPathMap, where the behaviour was as desired.
Repository: PowerToys
Issue: [FZ Editor] Add a Ruler 
Labels: Idea-Enhancement,FancyZones-Editor,Product-FancyZones

Split from #585 as requested.. 

When creating new layouts, it would be very useful to have on screen screen coordinates/ruler. In addition to the previous suggestions (#585), this would aid in perfectly aligning the various zones, for those of us that must have precision in our lives.