sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: go
Issue: runtime: select on a shared channel is slow with many Ps
Labels: Performance,compiler/runtime,Scalability

@tombergan and I have been debugging a severe performance regression that Kubernetes observed when switching from Go 1.7 to Go 1.8. The problem ended up being the addition of `net/http.Server.Shutdown` that's currently implemented by closing a channel that all the open connections select on.

(Details in https://github.com/kubernetes/kubernetes/issues/45216 and https://github.com/golang/go/issues/20302)

But the short summary is:

```go
package selbench
        
import "testing"
        
func BenchmarkSelectShared(b *testing.B) {
        idleShared := make(chan struct{})
        b.RunParallel(func(pb *testing.PB) {
                ch := make(chan int, 1)
                for pb.Next() {
                        select {
                        case ch <- 1:
                        case <-ch:
                        case <-idleShared:
                        }
                }
        })      
}       

func BenchmarkSelectPrivate(b *testing.B) {
        b.RunParallel(func(pb *testing.PB) {
                ch := make(chan int, 1)
                idlePrivate := make(chan struct{})
                for pb.Next() {
                        select {
                        case ch <- 1:
                        case <-ch:
                        case <-idlePrivate:
                        }
                }
        })
} 
```

Note that the idle channels below are never closed and are never selectable, but the other two are, and stay busy.

But when the channel is private to the goroutine (uncontended), things are fast. When it's a shared channel, things are slow.

```
$ go test -v -bench=Select -cpu=1,2,4,8,16,32,64
BenchmarkSelectShared           10000000               194 ns/op
BenchmarkSelectShared-2         10000000               147 ns/op
BenchmarkSelectShared-4          5000000               395 ns/op
BenchmarkSelectShared-8          3000000               449 ns/op
BenchmarkSelectShared-16         5000000               354 ns/op
BenchmarkSelectShared-32         5000000               320 ns/op
BenchmarkSelectShared-64         5000000               296 ns/op
BenchmarkSelectPrivate          10000000               192 ns/op
BenchmarkSelectPrivate-2        20000000                98.0 ns/op
BenchmarkSelectPrivate-4        30000000                49.3 ns/op
BenchmarkSelectPrivate-8        50000000                25.5 ns/op
BenchmarkSelectPrivate-16       100000000               13.8 ns/op
BenchmarkSelectPrivate-32       200000000                7.07 ns/op
BenchmarkSelectPrivate-64       200000000                6.31 ns/op
```

Are there any optimizations to be done here?

We'll work around it in the meantime and generally keep this in mind as an anti-pattern for performance.

/cc @aclements @randall77 @ianlancetaylor @rsc @josharian @mdempsky
Repository: rust
Issue: "consider adding an explicit lifetime bound `R: 'static" suggestion is misleading
Labels: C-enhancement,A-diagnostics,A-lifetimes,T-compiler,A-suggestion-diagnostics,D-newcomer-roadblock,D-invalid-suggestion,A-trait-objects

Consider an (incorrect) code:

```rs
trait Foo {}

struct Bar<R>(R);

impl<R> Foo for Bar<R> {
}

fn bb<R>(r: R) -> Box<Foo> {
    Box::new(Bar(r))
}

fn main() {
    let a = 10;
    let _b = bb(&a);
}
```

Rustc suggests:

```
consider adding an explicit lifetime bound `R: 'static`
```

This suggestion `R: 'static` is not good enough, code still won't compile.

The problem is that suggestion is misleading, because proper fix should be

```
fn bb<'r, R : 'r>(r: R) -> Box<Foo + 'r> { ... }
```

People who don't understand lifetimes well (like me), could stuck after adding `'static` bound.

So better suggestion could be something like:

```
consider adding an explicit lifetime bound `R: 'static`,
or lifetime parameter `<'r, R: 'r> ... -> ... Trait + 'r`
```

or do not mention `'static` at all:

```
consider adding an explicit lifetime bound to `R`
```

And also, I think, E0310 could have an example with non-static lifetime bound.
Repository: go
Issue: cmd/compile: trim more blocks?
Labels: Performance,compiler/runtime

In ssa/trim.go, func emptyBlock, the only op that counts as not generating instructions is OpPhi. But OpVarDef, OpVarKill, OpVarLive, and OpKeepAlive could probably qualify as "not generating instructions" as well. This would allow trimming more blocks.

cc @randall77
Repository: go
Issue: cmd/compile: lay out loop-free, likeliness-free control flow more compactly
Labels: Performance,compiler/runtime

```go
package p

func f() int {
	x := 0
	for i := 0; i < 10; i++ {
		odd := 0
		if i%2 == 0 {
			odd = 2 // not 1, otherwise this branch gets optimized away!
		}
		x += odd
		// Distract the layout pass with a bunch of loops.
		for j := 0; j < 10; j++ {
			for j := 0; j < 10; j++ {
				for j := 0; j < 10; j++ {
					x++
				}
			}
		}
	}
	return x
}
```

In this code, we have even odds of the `if i%2 == 0` branch being taken. But the code layout is pretty uneven. In this CFG, b3 is that branch, and b6 and b19 are the taken/not-taken blocks; both feed into b7. It seems like a good layout for this would be b3 b6 b19 b7 or b3 b19 b6 b7. But we put b19 at the very end of the function.

This is a simplified version of something that also happens in the fannkuch benchmark. See also #20355 and #18977.

For details on how to read this image, see #20355.

<img width="1680" alt="noncompactlayout" src="https://cloud.githubusercontent.com/assets/67496/26027267/db9ff9be-37bf-11e7-8fcb-f6a4e62a62f7.png">

cc @randall77 @dr2chase @cherrymui 

Marking 1.9Maybe because we removed the old backend's instruction re-ordering pass during 1.9; this may help prevent regressions from that.
Repository: vscode
Issue: Marked brackets range on scrollbar
Labels: feature-request,ux

- VSCode Version:1.12.1
- OS Version:Linux

Steps to Reproduce:

1. Click on the code, inside the brackets.
2. Marked brackets range on scrollbar.
Internal bracket marked with a main color.
External brackets in gray (all). Same with more nesting brackets.
![brackets-range-on-scrollbar](https://cloud.githubusercontent.com/assets/16800535/26028968/9dececb0-382a-11e7-814b-fff32eecd0be.png)
3. As soon as one brackets, it's just the main color.
![brackets-range-on-scrollbar2](https://cloud.githubusercontent.com/assets/16800535/26028965/97c3ada6-382a-11e7-81fa-c72370054c10.png)


This will be very useful. Particularly for longer code blocks, so that you can easily see where it ends and where it starts.
Repository: opencv
Issue: Feature request: when inRange receives a lower value higher than upper value return true when outside the range.
Labels: feature,category: core

Just as the title says. Would be very useful for example to detect red value in HSV colorspace, because it is in the range 340-360 and 0-20, so you would pass 340 as lower and 20 as upper.
Repository: electron
Issue: Allow ASAR to work with `child_process.spawn()`
Labels: enhancement :sparkles:

> There are Node APIs that can execute binaries like child_process.exec, child_process.spawn and child_process.execFile, but only execFile is supported to execute binaries inside asar archive.

> This is because exec and spawn accept command instead of file as input, and commands are executed under shell.

> - https://github.com/electron/electron/blob/master/docs/tutorial/application-packaging.md#executing-binaries-inside-asar-archive

This is not entirely correct. `.spawn()` executes the binary directly by default, just as `.execFile()` does. `.execFile()` actually uses `.spawn()` underneath. [`.spawn()` only runs the input in a shell if the `shell` option is set.](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options)

Not supporting `.spawn()` means a lot of apps are not able to use ASAR as they need the more flexible `.spawn()` method. For example, I need the `.spawn()` method so I can stream the output of `ffmpeg` while it's running. `.execFile()` only buffers and reports at the end.

Would also make sense to support `.spawnSync()` for completeness.

---

See https://github.com/electron/electron/issues/3512 for previous discussion.
Repository: TypeScript
Issue: Transpile to multiple targets at once
Labels: Suggestion,Awaiting More Feedback

By allowing multiple targets, transpilation speeds would be vastly improved for any project doing this already, as the AST only needs to be generated once.
Repository: TypeScript
Issue: lib.d.ts: members in CSSStyleDeclarations cannot be null per the spec
Labels: Bug,Help Wanted,Domain: lib.d.ts

**TypeScript Version:**  2.2.1

**Code**

```ts
// with --strictNullCheck

document.body.style.fontFamily.toString() // this should always work, fontFamily cannot be null

document.body.style.fontFamily = null; // this should also work per the spec...
document.body.style.fontFamily = ""; // semantically same
```

**Actual behavior:**

```
document.body.style.fontFamily.toString()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^Object is possibly null
```

If you are willing to accept a PR, what should be done here? Making it non-nullable breaks null-assigning lines, is it a good way to go?
Repository: opencv
Issue: CMake-GUI doesn't allow multiple choices of CPU_BASELINE and CPU_DISPATCH
Labels: feature,category: build/install

##### System information (version)
- OpenCV => 3.2 30170512
- Operating System / Platform => Windows 10 64 bit
- CMake => 3.8.1

##### Detailed description

![cmake](https://cloud.githubusercontent.com/assets/888148/26039068/d9d4e832-3950-11e7-912a-3764208d695d.png)

CMake-GUI doesn't allow multiple choices nor manual input of CPU_BASELINE and CPU_DISPATCH.

It is set by
```.cmake
set_property(CACHE CPU_BASELINE PROPERTY STRINGS "" ${CPU_KNOWN_OPTIMIZATIONS})
set_property(CACHE CPU_DISPATCH PROPERTY STRINGS "" ${CPU_KNOWN_OPTIMIZATIONS})
```
at line 270-271 of [/cmake/OpenCVCompilerOptimizations.cmake](https://github.com/opencv/opencv/blob/master/cmake/OpenCVCompilerOptimizations.cmake#L270-L271).

##### Steps to reproduce

Configure project w/ CMake-GUI.

##### Possible fixes
1. Use a generic string entry field(do not set STRINGS CACHE property of CPU_BASELINE and CPU_DISPATCH)
2. Use variables for each optimization(like deprecated style)
Repository: vscode
Issue: Can't see Newlines when Render Control Characters is turned on
Labels: feature-request,editor-core

<!-- Do you have a question? Please ask it on http://stackoverflow.com/questions/tagged/vscode -->

- VSCode Version: 1.12.1
- OS Version: Win 10 15063.296

Steps to Reproduce:

1. turn on render control chars in settings

```
    "editor.renderControlCharacters": true
```

2. open a file with newlines

Expect to see some visual representation of newlines like in Notepad++ or Atom's similar features

![image](https://cloud.githubusercontent.com/assets/8959496/26049192/0189cd62-390f-11e7-9114-e8218917fb40.png)


But instead see nothing...

![image](https://cloud.githubusercontent.com/assets/8959496/26049182/f7d629b4-390e-11e7-88ba-8cea22755db2.png)

**Edit 11/21/2024** - bubbling up my comment from below:

> Standard definition of a [control character](https://en.wikipedia.org/wiki/Control_character) is anything that doesn't represent a written symbol. LF line feed, CR carriage return, and HT horizontal tab [are all included in this].
>
> If this setting is supposed to do something else, then it shouldn't be labeled as `renderControlCharacters`.
Repository: flutter
Issue: Wish for one canonical place to edit the string that appears as "version" on the Play Store and App Store
Labels: c: new feature,tool,a: release,P3,team-tool,triaged-tool

Feature request: it would be nice to manage the version of an app through Flutter (have it somewhere in the flutter yaml file and be automatically reflected in both android and iOS builds).
Repository: flutter
Issue: Removing a plugin may make project unbuildable on iOS 
Labels: platform-ios,tool,has reproducible steps,P2,found in release: 2.2,a: plugins,team-ios,triaged-ios

I wanted to convert https://github.com/perlatus/flutter_zoomable_image from a plugin to a regular dart package (since it doesn't use any native code). That was more complicated than I thought. I expected to just do the following:

1. delete `android/` folder
1. delete `ios/` folder
1. remove `plugin` section from `pubspec.yaml`

After performing these steps the example app worked great on Android. However, on iOS, I was presented with build errors: 

```
    PhaseScriptExecution [CP]\ Check\ Pods\ Manifest.lock /Users/goderbauer/Library/Developer/Xcode/DerivedData/Runner-glyyagulozskefbxpevofwjpxfte/Build/Intermediates/Runner.build/Release-iphoneos/Runner.build/Script-4BFD143A4E00DC7226158EFA.sh
        cd /Users/goderbauer/dev/flutter_zoomable_image/example/ios
        /bin/sh -c /Users/goderbauer/Library/Developer/Xcode/DerivedData/Runner-glyyagulozskefbxpevofwjpxfte/Build/Intermediates/Runner.build/Release-iphoneos/Runner.build/Script-4BFD143A4E00DC7226158EFA.sh
    diff: /../Podfile.lock: No such file or directory
    diff: /Manifest.lock: No such file or directory
    error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
    
Could not build the precompiled application for the device.
```

From the exception it was unclear how to resolve those. After comparing the ios example app with a freshly created flutter app (`flutter create`) I figured out I had to do the following:

1. open up `example/ios/Runner.xcworkspace` in Xcode
1. In the `Build Phases` tab delete all three build pahses that start with `[CP]`
1. In the `Link Binary With Library` section delete `Pod_Runner.framework`

After that, the example app would also build and run on iOS.

We either need to document this or - if we expect this conversion to happen frequently - make it simpler.

/cc @collinjackson @mit-mit
Repository: TypeScript
Issue: Report errors (and quickfixes) for incorrect JSDoc
Labels: Suggestion,In Discussion,Domain: JSDoc

**TypeScript Version:**  nightly (2.4.0-dev.20170515)

**Code**

```ts
/**
 * @param abcdeg A parameter
 */
function f(abcdefg: number) {
    abcdeg;
}
```

**Expected behavior:**

Can fix spelling for either `abcdeg`.

**Actual behavior:**

Does not work in jsdoc.
Repository: rust
Issue: Add (a lot of) tests to rustdoc
Labels: A-testsuite,T-rustdoc,C-tracking-issue

Since we now have a more complete way to compare two HTML contents, I think we can now _**strongly**_ reinforce rustdoc's tests (which are a bit weak and lacking for now).

cc @rust-lang/docs
Repository: vscode
Issue: VS Code keyboard shortcuts suggestion to learn
Labels: feature-request,keybindings

Keyboard shortcuts are central part of VS Code, there are a lot of them and I think I use only a fraction of them. It would be awesome if VS Code could suggest what shortcut should I learn, based on how I use the app with mouse. For example if  I click between editors a lot, then VS Code could somehow tell me to use `ctrl+1` and `ctrl+2`. This way I could gradually learn shortcuts that would increase my productivity the most.
Repository: realworld
Issue: Challenge: Search
Labels: Status: RFC,v2 changelog

Search is the lifeblood of any good app worth its salt. Perhaps we can consider putting up an "extra credit" challenge to add the ability to search text in posts, tags, authors.
Repository: flutter
Issue: CI should check that flutter/packages uses the template where possible
Labels: team,package,team-ecosystem,P2,triaged-ecosystem

We could diff against the output of flutter create --plugin (with allowed exceptions for files that are normal to differ like main.dart, Info.plist, etc.) to ensure that they stay in sync with master.

This would have caught #10106 as well as a similar issue we saw in April with the hello_services sample.
Repository: go
Issue: go/build: does not support examples that use cgo
Labels: help wanted,NeedsInvestigation

While prototyping a library to work around #13656, I ran in to a pretty major issue with the godoc tool.  It doesn't generate any documentation at all for packages whose tests use cgo, which implies that packages designed for use with cgo *cannot* contain idiomatic examples.

```
bcmills:~/src$ go version
go version devel +b53acd89db Tue May 16 17:15:11 2017 +0000 linux/amd64
bcmills:~/src$ go tool doc cslice
doc: use of cgo in test /usr/local/google/home/bcmills/src/cslice/cslice_test.go not supported
```

cslice/cslice_test.go:
```go
package cslice_test

/*
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
*/
import "C"

import (
	"fmt"
	"reflect"
	"testing"
	"unsafe"

	"cslice"
)

func ExampleSetAt() {
	var (
		original *C.char  = C.CString("Hello, world!")
		sz       C.size_t = C.strlen(original)
	)
	defer C.free(unsafe.Pointer(original))

	var alias []byte
	cslice.SetAt(&alias, unsafe.Pointer(original), int(sz))

	fmt.Println("original:", C.GoString(original))
	fmt.Println("alias:", string(alias))
	copy(alias, "Adios")
	fmt.Println("original:", C.GoString(original))
	fmt.Println("alias:", string(alias))

	// Output:
	// original: Hello, world!
	// alias: Hello, world!
	// original: Adios, world!
	// alias: Adios, world!
}

func ExampleReflectAt() {
	var (
		original *C.char  = C.CString("Hello, world!")
		sz       C.size_t = C.strlen(original)
	)
	defer C.free(unsafe.Pointer(original))

	alias := cslice.ReflectAt(reflect.TypeOf(byte(0)), unsafe.Pointer(original), int(sz))

	fmt.Println("original:", C.GoString(original))
	fmt.Println("alias:", string(alias.Bytes()))
	reflect.Copy(alias, reflect.ValueOf([]byte("Adios")))
	fmt.Println("original:", C.GoString(original))
	fmt.Println("alias:", string(alias.Bytes()))

	// Output:
	// original: Hello, world!
	// alias: Hello, world!
	// original: Adios, world!
	// alias: Adios, world!
}
```
Repository: kubernetes
Issue: Hook initContainers into lifecycle
Labels: kind/feature,sig/apps,lifecycle/frozen

**Is this a BUG REPORT or FEATURE REQUEST?** (choose one): FEATURE REQUEST
**Kubernetes version** (use `kubectl version`): 
```
Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.2", GitCommit:"477efc3cbe6a7effca06bd1452fa356e2201e1ee", GitTreeState:"clean", BuildDate:"2017-04-19T22:51:55Z", GoVersion:"go1.8.1", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.0", GitCommit:"fff5156092b56e6bd60fff75aad4dc9de6b6ef37", GitTreeState:"clean", BuildDate:"2017-05-09T23:22:45Z", GoVersion:"go1.7.3", Compiler:"gc", Platform:"linux/amd64"}
```

**Environment**:
- **Cloud provider or hardware configuration**: `minikube` `xhyve`
- **OS** (e.g. from /etc/os-release): `macosx`
- **Kernel** (e.g. `uname -a`): `Darwin ML-VSITZ-OSX-SF 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64`
- **Install tools**:
- **Others**:


**Feature**:

`initContainers` feature works great for use cases when the initialization happens on the volumes. But oftentimes this initialization have to happen in the service itself, e.g: inject a datasource in grafana before grafana is considered ready: pre-ready.

`initContainers` feature doesn't seem o allow the container to be hooked to an specific moment of the lifecycle.

`initContainers` feature should allow the container to be hooked to an specific moment of the lifecycle.
Repository: opencv
Issue: Persistence: overflow for long values
Labels: RFC

##### System information (version)

- OpenCV => Current head
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2013

##### Detailed description

OpenCV cannot deserialize ``long long`` and truncates to int instead.

    long long a; fs["element"] >> a;
does not compile because
> opencv2/core/persistence.hpp(1242): error C2665: 'cv::read' : none of the 16 overloads could convert all the argument types

But if you try to work around and instead use a double, an element bigger than ``INT_MAX`` is set to INT_MAX without any warning

##### Steps to reproduce

    int main(int argc, char* argv[])
    {
        int intE;
        double longE, doubleE;
        cv::FileStorage fs;

        // Try it with YAML
        fs.open("%YAML 1.0\nintE: 2147483647\nlongE: 414748364711\ndoubleE: 414748364711.", cv::FileStorage::READ | cv::FileStorage::MEMORY);
        fs["intE"] >> intE;
        fs["longE"] >> longE;
        fs["doubleE"] >> doubleE;

        std::cout << intE << "  " << longE << "  " << doubleE << std::endl;

        // Try it with JSON
        fs.open("{\"intE\": 2147483647,\n\"longE\": 414748364711,\n\"doubleE\": 414748364711.}", cv::FileStorage::READ | cv::FileStorage::MEMORY | cv::FileStorage::Mode::FORMAT_JSON);
        fs["intE"] >> intE;
        fs["longE"] >> longE;
        fs["doubleE"] >> doubleE;

        std::cout << intE << "  " << longE << "  " << doubleE << std::endl;

        return 0;
    }

produces the output

>  2147483647  2.14748e+009  4.14748e+011
>  2147483647  2.14748e+009  4.14748e+011

but expected would be

>  2147483647  4.14748e+011  4.14748e+011
>  2147483647  4.14748e+011 4.14748e+011

and the option to use ``cv::read`` for a long long
Repository: go
Issue: cmd/internal/src: XPos.After doesn't necessarily match Pos.After
Labels: NeedsInvestigation,compiler/runtime

XPos.After (and XPos.Before) compares XPoses with different bases according to their base index, which is determined by the order they're added to the PosTable. I think this is worrying because we don't currently have any code in the compiler to ensure PosBase are registered in order.

Possible solutions I see:

1. Change XPos.After's signature to take a \*PosTable parameter and return the result of comparing the corresponding Pos values.
2. Change package syntax's parser to register PosBase with the PosTable during parsing. (Will require locking.)
3. Change package syntax's parser to collect all PosBase into a slice which we can register serially once parsing is done.

/cc @griesemer
Repository: opencv
Issue: cv::drawMarker should support sub-pixel precision using shift parameter
Labels: feature,category: imgproc

Most of OpenCV's drawing functions support sub-pixel precision using the `shift` parameter. It would be nice to add support for that to `cv::drawMarker` too.