sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: react
Issue: Optimizing Compiler: Compiling to Internals
Labels: React Core Team

This optimization is a renderer specific optimization. It is about knowing how React will process a particular component in its internals and then inlining that internal work into the user code.

It comes in two flavors.
# Known Host Component

``` js
function Foo(props) {
  if (props.data.type === 'img') {
    return <img src={props.data.src} className={props.className} />;
  }
  return <span className={props.className}>{props.children}</span>;
}
```

Into this:

``` js
function Foo_optimizedMount(props) {
  if (props.data.type === 'img') {
    var img = document.createElement('img');
    img.className = props.className;
    img.src = props.data.src;
    return {
      node: img,
      listeners: ReactEventListeners.trap(img, 'error', 'load')
    };
  }
  var span = document.createElement('span');
  span.className = props.className;
  var children = ReactChildren.mountNestedChildrenIntoParent(this.props.children, span);
  return { node: span, children };
}

function Foo_optimizedUpdate(instance, oldProps, newProps) {
  if (oldProps.data.type !== newProps.data.type) {
    Foo_optimizedUnmount(instance);
    return Foo_optimizedMount(newProps);
  }
  if (props.data.type === 'img') {
    img.className = props.className;
    img.src = props.data.src;
    return instance;
  }
  span.className = props.className;
  ReactChildren.updateNestedChildrenInParent(this.props.children, instance);
  return instance;
}

function Foo_optimizedUnmount(instance) {
  if (oldProps.data.type !== newProps.data.type) {
    Foo_optimizedUnmount(instance);
    return Foo_optimizedMount(newProps);
  }
  if (props.data.type === 'img') {
    ReactEventListeners.release(instance.listeners);
  }
  ReactChildren.unmountNestedChildrenInParent(instance);
}
```
# Composite Components

Similarly, composite components can pick different code branches to imperatively update its children. For example, a known constant value wouldn't be considered, and comparison of a single property can potentially bail out a tree.

Although it is unclear if this has significant benefits over these two other optimizations:

https://github.com/facebook/react/issues/3227
https://github.com/facebook/react/issues/7323
Repository: rust
Issue: u32 saturating_mul with small constant is slower than a multiply+compare
Labels: I-slow,C-enhancement

```
#![feature(test)]
#![feature(core_intrinsics)]

extern crate test;

static mut XXX: u32 = 10;

use test::Bencher;

#[bench]
fn bench_sat_mul(b: &mut Bencher) {
    b.iter(|| unsafe {
        for _ in 1..1000 {
            let mut r = std::intrinsics::volatile_load(&XXX);
            r = r.saturating_mul(3);
            std::intrinsics::volatile_store(&mut XXX, r);
        }
    });
}

#[inline(always)]
fn fast_saturating_mul(a: u32, b: u32) -> u32 {
    let r = a as u64 * b as u64;
    if r > 0xFFFFFFFF { 0xFFFFFFFF } else { r as u32 }
}

#[bench]
fn bench_sat_mul_2(b: &mut Bencher) {
    b.iter(|| unsafe {
        for _ in 1..1000 {
            let mut r = std::intrinsics::volatile_load(&XXX);
            r = fast_saturating_mul(r, 3);
            std::intrinsics::volatile_store(&mut XXX, r);
        }
    });
}
```

Resulting timings (x86-64 Linux, Ivy Bridge processor):

```
test bench_sat_mul   ... bench:       4,354 ns/iter (+/- 231)
test bench_sat_mul_2 ... bench:       3,710 ns/iter (+/- 108)
```

Maybe not a perfect benchmark, but there's probably something worth looking at.  ~~Originally reported at https://users.rust-lang.org/t/unexpected-performance-from-array-bound-tests-and-more/6376/5 .~~
Repository: rust
Issue: u32 saturating_mul+compare slower than u64 mul+compare
Labels: I-slow,C-enhancement

``` rust
#![feature(test)]
#![feature(core_intrinsics)]

extern crate test;

static mut XXX: u32 = 10;

use test::Bencher;

#[bench]
fn bench_sat_mul(b: &mut Bencher) {
    b.iter(|| unsafe {
        for _ in 1..1000 {
            let r = std::intrinsics::volatile_load(&XXX);
            let r2 = std::intrinsics::volatile_load(&XXX);
            let r = r.saturating_mul(r2);
            let r = if r > 1000000000 { 1000000000 } else { r };
            std::intrinsics::volatile_store(&mut XXX, r);
        }
    });
}

#[bench]
fn bench_sat_mul_2(b: &mut Bencher) {
    b.iter(|| unsafe {
        for _ in 1..1000 {
            let r = std::intrinsics::volatile_load(&XXX);
            let r2 = std::intrinsics::volatile_load(&XXX);
            let r = r as u64 * r2 as u64;
            let r = if r > 1000000000 { 1000000000 } else { r as u32 };
            std::intrinsics::volatile_store(&mut XXX, r);
        }
    });
}
```

Originally reported at https://users.rust-lang.org/t/unexpected-performance-from-array-bound-tests-and-more/6376/5 .

The two different code sequences:

```
    deac:       f7 e2                   mul    %edx
    deae:       0f 40 c7                cmovo  %edi,%eax
    deb1:       3d 00 ca 9a 3b          cmp    $0x3b9aca00,%eax
    deb6:       0f 47 c3                cmova  %ebx,%eax
```

```
    df3c:       48 0f af f3             imul   %rbx,%rsi
    df40:       48 81 fe 00 ca 9a 3b    cmp    $0x3b9aca00,%rsi
    df47:       0f 43 f2                cmovae %edx,%esi
```

There also seems to be some effect on loop unrolling.
Repository: react
Issue: IE 11 and Edge no longer prompt to remember password on controlled form
Labels: Type: Bug,Component: DOM

**Do you want to request a _feature_ or report a _bug_?**
Bug (regression) IE/Edge

**What is the current behavior?**
On React > v15.2.0, Edge and IE11 do not prompt the user to save the password for the form

**Steps to reproduce**
With react 15.1.0:
https://jsfiddle.net/69z2wepo/49876/
With React 15.2.0:
https://jsfiddle.net/69z2wepo/49877/

**What is the expected behavior?**
The browser prompts the user to save their password for the form

**Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?**
React > 15.2.0. It worked in React 15.2.0
IE 11, Edge
Repository: go
Issue: x/crypto/ssh: Additional information from HostKeyCallback or Handshake failure
Labels: NeedsInvestigation

Please answer these questions before submitting your issue. Thanks!
1. What version of Go are you using (`go version`)?
   1.6.2
2. What operating system and processor architecture are you using (`go env`)?
   linux/amd64
3. What did you do?
   Set a custom callback for ClientConfig HostKeyCallback
4. What did you expect to see?
   My own error when creating a client connection that failed due to my HostKeyCallback.
   The server returns the error as-is
   https://github.com/golang/crypto/blob/master/ssh/server.go#L151
   I wrongly assumed my error would be passed through in a similar fashion to how Bolt's API works, so this isn't a bug/issue so much as it is a small feature request.
5. What did you see instead?
   A new "generic" error wrapped by fmt.Errorf
   https://github.com/golang/crypto/blob/master/ssh/client.go#L77

So currently in the error I return from my HostKeyCallback I set additional information I'd like to retrieve later when making a client connection. Currently this is difficult because the error is always wrapped by fmt.Errorf at the line above. I know I can set additional state in my function (maybe a map with a mutex) or run a regex against the returned error to see if it contains my error, but neither of those seemed very good.

My idea is to add a simple HandshakeError type that saves a reference to the original error and is returned in the client handshake (maybe the sever handshake too). Something like this
https://play.golang.org/p/EjM5ijecz3
There are already other Error types in that package, and this one would print the same output if someone was expecting it. Alternatively removing the fmt.Errorf call would work, and would match how the ssh server returns the error from its handshake, which ever is best.
Repository: nvm
Issue: `nvm run` does not work with files whose names consist of digits
Labels: bugs,pull request wanted

If file name consist only digits before point, `nvm run` doesn't work.

How test:

``` bash
mkdir /tmp/nvm_run
cd /tmp/nvm_run
echo 'console.log("hi")' > 123.js
nvm run 123.js
```

Output:

```
N/A: version "123.js" is not yet installed.

You need to run "nvm install 123.js" to install it before using it.
```

The following file names are also not work:
- `123`
- `1.2.3.js`
- `1.2.3.4.5.6.js`
- `1.2.3.js`
- `v123.js`
- `v1.23.js`
- `v1.js`
- `v1`

`nvm debug`:

```
nvm --version: v0.31.3
$SHELL: /bin/bash
$HOME: /home/dima
$NVM_DIR: '/tmp/nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: v6.3.0
which node: $NVM_DIR/versions/node/v6.3.0/bin/node
which iojs: 
which npm: $NVM_DIR/versions/node/v6.3.0/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v6.3.0
npm root -g: $NVM_DIR/versions/node/v6.3.0/lib/node_modules
```

Debian GNU/Linux testing (stretch)
Repository: three.js
Issue: Compress RectAreaLight BRDF Data and include in three.js build files
Labels: Enhancement

This issue can serve as discussion for improving the preliminary RectAreaLight implementation being reviewed in #9234.

Currently, the BRDF for the RectAreaLight implementation is approximated using float textures totaling ~80kb when the data is included as discrete, raw, float values.  Methods to compress that data need to be explored in order for it to be viable to include the data directly in the three.js source.  

Possible methods include:
- fit a 3d surface function to each of the five 2d float data sets
- compress the data (e.g. via a kmeans vectorization, or precision reduction)

@bhouston @WestLangley @tschw
Repository: TypeScript
Issue: Proposal: Type Relationship API
Labels: Suggestion,In Discussion,API

They type checker has no public API for checking type relationships or for looking up types in a given scope. This can make writing semantic-analysis informed lint rules very difficult (either because you need to replicate a lot of logic, or because you simply don't have enough information). Since [tslint enabled semantic checks](https://github.com/palantir/tslint/commit/9248e056c1a652ee13597e68da26cacf0b87e134) we now have a popular consumer who would very much like to be able to perform meaningful semantic comparisons (See [this rule](https://github.com/palantir/tslint/pull/1394#issuecomment-234384650) for instance).
# Proposal

A small new set of public API methods on the type checker:

``` ts
interface TypeChecker {
  isIdenticalTo(a: Type, b: Type): boolean; // Exposes internal identity relationship
  isSubtypeOf(a: Type, b: Type): boolean; // Exposes internal structural subtype relationship
  isAssignableTo(a: Type, b: Type): boolean; // Exposes internal assignable relationship
  isComparableTo(a: Type, b: Type): boolean; // Exposes internal comparable relationship
  isInstantiationOf(a: GenericType, b: GenericType): boolean; // While not an internal relationship, it is a straightforward semantic question to ask an answer which requires internal APIs to answer

  lookupGlobalType(name: string): Type; // Looks up a global symbol named "name" with meaning SymbolFlags.Type (Identical to getGlobalType but without the expected arity based return value) - returns unknownType on failure
  lookupTypeAt(name: string, position: Node): Type // Resolve a symbol lexically at the position specified with meaning SymbolFlags.Type (identical to resolveName, but with less levers) - returns unknownType on failure

  getAnyType(): IntrinsicType;
  getStringType(): IntrinsicType;
  getNumberType(): IntrinsicType;
  getBooleanType(): IntrinsicType;
  getVoidType(): IntrinsicType;
  getUndefinedType(): IntrinsicType;
  getNullType(): IntrinsicType;
  getESSymbolType(): IntrinsicType;
  getNeverType(): IntrinsicType;
  getUnknownType(): IntrinsicType;
  getStringLiteralType(text: string): StringLiteralType; // When numeric literal types merge, they should have a similar endpoint
}
```

While this isn't a complete set of APIs for manipulating the type checker (I've left off an API to programatically create new types for comparison), it is enough to do meaningful analysis with existing types in the compilation without resorting to brittle (or often wrong) syntax-based solutions.
Repository: vscode
Issue: Indent Guides Have Breaks Where CodeLens UI is Rendered
Labels: feature-request,code-lens,editor-indent-guides

- VS Code Version: 1.4.0-insiders (a4522)
- OS Version: Windows 10 1607 (Build 14393)

Steps to Reproduce:
1. Enable indent guides in VS Code.
2. Open code file that uses CodeLens (C#, etc.)
3. Observe breaks in rendered indent guides where CodeLens UI is rendered.

![image](https://cloud.githubusercontent.com/assets/208549/17044738/a29a2468-4f77-11e6-8e85-9e3ddaa41e0e.png)
Repository: nvm
Issue: `nvm use` does not fully respect `--silent`
Labels: feature requests,needs followup

It runs `nvm_rc_version`, which echos "Found ..." and "Now using..."
All output should be silenced (or introduce --silence-all or `nvm --quiet use` or something)
Repository: vscode
Issue: Cursor Up and Down should place the cursor at end of line if it's current state is end of line
Labels: feature-request,api,VIM

- Move the cursor to End of line by using `End` or `Cmd + Right` 
- Now doing Up or Down commands should place the cursor at the End.

But currently VS Code is placing the cursor at `min(previousPos, lineLength)`
Repository: TypeScript
Issue: Suggestion: Allow local types to be declared in interfaces
Labels: Suggestion,Awaiting More Feedback

I have something like this:

```
export interface Reducer<State, Types extends Action<string, any>> {

    add<TypeName extends string, Payload>(action: {
        type: TypeName,
        reduce: (state: State, action: Payload) => State
    }): Reducer<State, Types | Action<TypeName, Payload>>;

    readonly cursorType: Cursor<State, Types>;
}
```

The details aren't that important except to illustrate that a `Reducer` is immutable, and has an `add` method that returns another `Reducer`, but see that the return type has something extra "unioned" into it. By repeated chained calls to `add` I can build up a big nasty old type that would be ugly to have fully declare by hand. Fortunately type inference takes care of building the type for me, which is great.

Then elsewhere in my code I want to be able to declare something called a "cursor", which needs to have a type that corresponds to the reducer's type. The cursor could be a field in a class so I need to be able to refer to the type so I can declare such a field.

So I want to provide a simple way to declare a const of the type "correct kind of cursor for a given reducer", leveraging the work that the TS compiler already did for me with its type inference.

My slightly hacky approach, as shown above, is to declare a readonly field `cursorType`. The value of this is at runtime is junk and should not be used! So I need a "here be dragons" comment on it. Its only purpose is to be prefixed with `typeof`, e.g.:

```
const R = getReducerSomehow();

class Test {
    constructor(public readonly myCursor: typeof R.cursorType) { }
}
```

To fill in the `cursorType` field of a `Reducer` I have to do this filth:

```
newReducer.cursorType = {} as Cursor<State, Types>;
```

So `cursorType` really should never be used as a value. It doesn't even need to exist as a value. It will cause a runtime error if anyone tries to used it as a cursor. Ugh. But how else can I make this elaborately computed type available conveniently?

I'm wondering if TS could allow:

```
export interface Reducer<State, Types extends Action<string, any>> {

    add<TypeName extends string, Payload>(action: {
        type: TypeName,
        reduce: (state: State, action: Payload) => State
    }): Reducer<State, Types | Action<TypeName, Payload>>;

    // not currently possible:
    type CursorType = Cursor<State, Types>;
}
```

i.e. a `type` alias can be added to an interface. So now my implementation of `Reducer` no longer has to do anything. No nasty dummy runtime variable hack required.

And my usage example becomes:

```
const R = getReducerSomehow();

class Test {
    constructor(public readonly myCursor: R.CursorType) { }
}
```

That is, `CursorType` is a type that can be referred to _as if_ it was a member of an instance. Similar I guess to:

```
namespace N {
    export type S = string;
}

const s: N.S = "hi";
```

In which `N` is an object at runtime and yet can also be used to find the type `S`.
Repository: rust
Issue: "Type annotations needed" with mixed lifetimes in trait bounds
Labels: A-type-system,C-enhancement,A-lifetimes,P-medium,T-lang,T-types

This was encountered from a [derive plugin that created where bounds for all member types](https://github.com/serde-rs/serde/issues/443#event-731862636). Occurs on stable, beta, and nightly.

``` rust
struct S<'a>(&'a ());

trait Tr { }
impl<T> Tr for Option<T> { }
impl<'a> Tr for S<'a> where Option<&'a str>: Tr, Option<&'static str>: Tr { }
```

```
error: mismatched types [--explain E0308]
 --> <anon>:5:1
  |>
5 |> impl<'a> Tr for S<'a> where Option<&'a str>: Tr, Option<&'static str>: Tr { }
  |> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
note: expected type `Tr`
note:    found type `Tr`
note: the lifetime 'a as defined on the impl at 5:0...
 --> <anon>:5:1
  |>
5 |> impl<'a> Tr for S<'a> where Option<&'a str>: Tr, Option<&'static str>: Tr { }
  |> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...does not necessarily outlive the static lifetime

error: aborting due to previous error
```

[playpen repro](https://is.gd/UgB9SI)
Repository: vscode
Issue: Problem matchers for error messages that span multiple lines
Labels: feature-request,tasks

- VSCode Version: 1.4.0-insider 01a3f8
- OS Version: Windows 10 x64

I'm unable to get a message built up from several lines in the output. In the output below, I would like the message to contain the spec name, and the reason it failed. Any ideas if this is possible?

I have the following output from NUnit:

```
Project dotnettesting (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
NUnit .NET Core Runner 3.4.0 
Copyright (C) 2016 Charlie Poole
Runtime Environment
    OS Platform: Windows
     OS Version: 10.0.10586
        Runtime: win10-x64
Test Files
    c:\projects\dotnettesting\bin\Debug\netcoreapp1.0\dotnettesting.dll
Errors and Failures
1) Failed : CalculatorSpec.ShouldFail
  Expected: 0
  But was:  3
at CalculatorSpec.ShouldFail() in c:\projects\dotnettesting\Calculator.spec.cs:line 12
2) Failed : CalculatorSpec.Will_Fail
  Expected: 0
  But was:  3
at CalculatorSpec.Will_Fail() in c:\projects\dotnettesting\Calculator.spec.cs:line 17
Run Settings
    WorkDirectory: c:\projects\dotnettesting
Test Run Summary
  Overall result: Failed
  Test Count: 3, Passed: 1, Failed: 2, Inconclusive: 0, Skipped: 0
    Failed Tests - Failures: 2, Errors: 0, Invalid: 0
  Start time: 2016-07-22 19:16:50Z
    End time: 2016-07-22 19:16:51Z
    Duration: 0.362 seconds
Results saved as c:\projects\dotnettesting\TestResult.xml
SUMMARY: Total: 1 targets, Passed: 0, Failed: 1.
```

I have configured the following problem matcher:

``` json
"pattern": [
    {
        "regexp": "^\\d+\\) Failed.*$"
    },
    {
        "regexp": "^(.*)$",
        "message": 1
    },
    {
        "regexp": "^(.*)$",
        "message": 1
    },
    {
        "regexp": "^at (.*\\(\\)) in (.*):line (\\d+)$",
        "location": 3,
        "file": 2
    }
]
```
Repository: go
Issue: proposal: io/v2: CopyBuffer should avoid ReadFrom/WriteTo
Labels: Performance,v2,Proposal

Currently, io.CopyBuffer uses WriteTo if the src supports it and ReadFrom if the dst supports it, presumably to avoid an allocation.

The problem is that there exist certain io.ReaderFrom that are not efficient 100% of the time. For example, consider the following implementation of ReadFrom:

``` go
type myWriter struct {
    w io.Writer
}

func (mw *myWriter) ReadFrom(src io.Reader) (int64, error) {
    if r, ok := mw.w.(io.ReaderFrom); ok {
        return r.ReadFrom(src)
    }
    return io.Copy(struct{ io.Writer }{mw}, src)
}
```

This is unfortunate as myWriter satisfies the io.ReaderFrom interface, but it's implementation is no better than io.Copy (always incurring an allocation) in some circumstances.

In the case of io.CopyBuffer, I would argue that the user's expectation is that the buffer passed in is _always_ used. It has the detriment of an extra copy, but I believe the cost of that is much lower than the allocation that is already saved by the user providing the buffer. It main benefit is that it avoids any shenanigans that occur because of inefficient implementations of io.ReaderFrom and io.WriterTo.

Alternative is to do anonymous struct value hack:

``` go
io.CopyBuffer(struct{ io.Writer }{dst}, struct{ io.Reader }{src}, buf)
```

But, this hack is not intuitive to most people.

Filed on behalf of @jkji
Repository: TypeScript
Issue: how can i implement ts.CompilerOptions in a class?
Labels: Docs

![image](https://cloud.githubusercontent.com/assets/937933/17079355/a476d0be-50db-11e6-880f-7a92f3eabdbf.png)

``` typescript
class implements ts.CompilerOptions {
}
```
Repository: go
Issue: x/tools/cmd/goyacc: endless loop on unterminated comment at EOF
Labels: Tools

1. What version of Go are you using (`go version`)?

go version go1.6.2 windows/amd64
go version devel +10538a8 Fri Jul 22 22:23:14 2016 +0000 windows/amd64
1. What operating system and processor architecture are you using (`go env`)?

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\rillig\go
set GORACE=
set GOROOT=C:\Users\rillig\gomaster
set GOTOOLDIR=C:\Users\rillig\gomaster\pkg\tool\windows_amd64
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Program Files\cygwin\tmp\go-build959343002=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
1. What did you do?

printf '%%\nstart : /\* empty \* {}\n%%\n' > endless.y
go tool yacc endless.y
1. What did you expect to see?

endless.y:3: unterminated comment at EOF
1. What did you see instead?

No output, and the process apparently hangs in an endless loop.
Repository: rust
Issue: path attribute on modules is useless in nested modules
Labels: C-enhancement,A-diagnostics,P-low,E-mentor,T-compiler,E-medium

My crate has some test support data in `tests/support/mod.rs`. When trying to load this module for unit tests like this:

``` rust
mod tests {
    #[path="../tests/support/mod.rs"]
    mod support;
}
```

I get an error like this:

```
error: couldn't read "src/tests/../tests/support/mod.rs": No such file or directory (os error 2)
```

In fact, specifying pretty much any path is going to fail, because the `src/tests/` directory does not exist, because I'm using a nested module and not a separate file. When using nested modules, I think the path at which relative path resolution should start should be the directory that the actual source file is in.
Repository: flutter
Issue: Flutter should offer some way to test at a minimum size
Labels: a: tests,framework,f: material design,P2,team-design,triaged-design

@sethladd has recently started filing bugs about our Material Widgets looking wrong on an iPod touch (which is slightly less wide than the Nexus 5s many of us test on).

Many of these bugs could presumably be caught by some automated system which at least tested to make sure views didn't throw exceptions at known resolutions.

@Hixie says the hardest part about this is a "minimum size" and is less worried about the continuum of sizes above that.

Example bugs include #5003 or #5019 (particularly #5019 looks like it could be caught in an automated fashion.  FYI @yjbanov
Repository: flutter
Issue: Update license collection script to perform line wrapping and indentation normalization
Labels: c: new feature,engine,P3,team-engine,triaged-engine

This would improve both the rendering of the licenses and reduce the total number of licenses, which would reduce the executable size.