sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: godot
Issue: String::sha256_text() shows up as a hotspot during game launch
Labels: enhancement,topic:core,performance

### Tested versions

Reproducible in:  Godot v4.2.stable - macOS 14.3.0 - Vulkan (Forward+) - integrated Apple M1 Pro - Apple M1 Pro (10 Threads)

### System information

Godot v4.2.stable - macOS 14.3.0 - Vulkan (Forward+) - integrated Apple M1 Pro - Apple M1 Pro (10 Threads)

### Issue description

I profiled my app's startup performance and noticed a hot spot in this call sequence:

```
8	String::utf8() const	
5	String::sha256_text() const	
5	ShaderRD::setup(char const*, char const*, char const*, char const*)	
2	Fsr2AccumulatePassShaderRD::Fsr2AccumulatePassShaderRD()	
2	Fsr2AccumulatePassShaderRD::Fsr2AccumulatePassShaderRD()	
2	RendererRD::FSR2Effect::'unnamed'::()	
2	RendererRD::FSR2Effect::'unnamed'::()	
2	RendererRD::FSR2Effect::FSR2Effect()	
2	RendererRD::FSR2Effect::FSR2Effect()	
2	RendererSceneRenderImplementation::RenderForwardClustered::RenderForwardClustered()	
2	RendererSceneRenderImplementation::RenderForwardClustered::RenderForwardClustered()	
2	RendererCompositorRD::RendererCompositorRD()	
2	RendererCompositorRD::RendererCompositorRD()	
2	RendererCompositorRD::_create_current()	
2	RendererCompositor::create()	
2	RenderingServerDefault::RenderingServerDefault(bool)	
2	RenderingServerDefault::RenderingServerDefault(bool)	
2	Main::setup2()	
2	Main::setup(char const*, int, char**, bool)	
```

Inspecting `String::sha256_text()` we see it's converting it's character data to utf8 before computing the sha256 value:

```c++
String String::sha256_text() const {
	CharString cs = utf8();
	unsigned char hash[32];
	CryptoCore::sha256((unsigned char *)cs.ptr(), cs.length(), hash);
	return String::hex_encode_buffer(hash, 32);
}
```

Looking at the `.utf8()` method (omitted for brevity), I see that it first scans all the 32-bit code points to calculate the length of the eventual buffer, then it allocates, then it scans again to do the copy. We could do better by changing how the sha256 is computed. Like `String::hash64()` we could compute the sha256 directly using the 32-bit codepoints (or their bytes). Since processors are pretty well adapted to fetching and adding 32-bit values, this would probably end up being a lot faster. Of course, if the algorithm is required to be using the utf8 code points, then we could avoid the copy altogether and write a custom version of sha256 that scans the 32-bit code points directly, converting them to their utf8 versions and computing the hash. Either way would probably be a bit faster than the current approach.

These same optimizations could be made to `String::sha1_text()`, `String::md5_buffer()`, et. al.

### Steps to reproduce

Profiling any Godot app during startup will likely expose these hot spots. Just launch the app while profiling and look for hot spots.

### Minimal reproduction project (MRP)

You'd need a build with profiling enabled to reproduce this. Any trivial Godot project will likely do.

[GodotBouncingBall.zip](https://github.com/godotengine/godot/files/13694799/GodotBouncingBall.zip)
Repository: TypeScript
Issue: emit an error when using #private fields in their "temporal dead zone"
Labels: Suggestion,Awaiting More Feedback

### 🔍 Search Terms

error for private member accessed before ready

### ✅ Viability Checklist

- [X] This wouldn't be a breaking change in existing TypeScript/JavaScript code
- [X] This wouldn't change the runtime behavior of existing JavaScript code
- [X] This could be implemented without emitting different JS based on the types of the expressions
- [X] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- [X] This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- [X] This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals

### ⭐ Suggestion

This produces a runtime error when you run it:

```ts
abstract class Base {
  constructor() {
	this.createStuff()
  }

	abstract createStuff(): void
}

class Sub extends Base {
	#makeSomething() {
		console.log('make stuff')
	}

	createStuff() {
		this.#makeSomething()
	}
}

// TypeError: Cannot read private member from an object whose class did
// not declare it (JavaScript points finger at you while laughing)
new Sub().createStuff()
```


[playground](https://www.typescriptlang.org/play?#code/IYIwzgLgTsDGEAJYBthjAgQmgpgg3gFAJID2AdpFAK7ylQAUAlAYQJAQAWAlmAHSwoOYBBwBlCNQBmU5sQQBfQu1BU4iQcNETpspgC4EAN1LcAJoSWEUaDGOogEOAB6jyZjNjB4ibAMQAtsAA1uKkAThc3OQA5sysbGywFGCkyDh8yKRxAORBoQiQujlM7FZJQiLikjLxvhw8-IEhYRFRsXJsSlYA9D0IACoAngAOOACiUFD0hgDCwOTkpIiVZggjUNxGVQgRASA4UAhS0wEICwikIABWOPAIAO6cpN5IqOgIZuYIS4hmd6ghAhuIgGAApYDbMSCbgjRCcNDnBCoagxTilcg4B4IewgZgCSraGp6QhAA)

### 📃 Motivating Example

It has happened to me too many times due to subclass code running early before initialization of private fields.

Unfortunately the simple solution is to avoid class fields for this case (use properties-defined-in-constructor, or `get`ters).

### 💻 Use Cases

Sometimes we want a constructor to make stuff generically for subclasses, but then subclasses should override or implement some methods to replace certain parts.

I believe there is enough static info that it would be possible to check for this case and emit a compile error.

Similarly it would also be possible to enforce non-private fields to be `| undefined` when used early in a location that is known to be called before initialization (f.e. in a superclass constructor).
Repository: godot
Issue: Unable to initialize Vulkan video driver for the MacOS export when dynamically linked inside app bundle
Labels: platform:macos,topic:rendering,needs testing

### Tested versions

- Reproducible in `4.1`

### System information

Godot v4.1.3.stable - macOS 13.3.1 - Vulkan (Forward+) - integrated Apple M1 Pro - Apple M1 Pro (10 Threads)

### Issue description

I was following this guide (https://docs.godotengine.org/en/4.1/contributing/development/compiling/compiling_for_macos.html#building-export-templates) to build an export template with my own encryption key (I have `SCRIPT_AES256_ENCRYPTION_KEY` environment variable). I included `libMoltenVK.dylib` inside the `macos_template.app` and used `use_volk=yes` parameter for `scons` command.

Here's my `macos_template.app` structure:
```
❯ ls -R
Contents

./Contents:
Frameworks Info.plist MacOS      PkgInfo    Resources

./Contents/Frameworks:
libMoltenVK.dylib

./Contents/MacOS:
godot_macos_debug.universal   godot_macos_release.universal

./Contents/Resources:
icon.icns
```
After that I used this bundled template to generate export with this command:
```
❯ ./Godot --path <project_path> --export-release macos macos.dmg
```
The internal structure of the generated export:
```
❯ ls -R
Contents

./YouTD 2.app//Contents:
Frameworks     Info.plist     MacOS          PkgInfo        Resources      _CodeSignature

./YouTD 2.app//Contents/Frameworks:
libMoltenVK.dylib

./YouTD 2.app//Contents/MacOS:
YouTD 2

./YouTD 2.app//Contents/Resources:
YouTD 2.pck icon.icns

./YouTD 2.app//Contents/_CodeSignature:
CodeResources
```
However, when I run the executable on the same machine where I built it I get this error:
<img width="521" alt="Screenshot 2023-12-16 at 10 01 14 PM" src="https://github.com/godotengine/godot/assets/10060411/3f5135ea-df2e-4288-bc85-f317e93cd6c0">


### Steps to reproduce

Follow this guide (https://docs.godotengine.org/en/4.1/contributing/development/compiling/compiling_for_macos.html#building-export-templates) to build an export template with provided encryption key. Include `libMoltenVK.dylib` inside templates. Try exporting any of you project with compiled templates and run it. You should have the same error screen.
<img width="521" alt="Screenshot 2023-12-16 at 10 01 14 PM" src="https://github.com/godotengine/godot/assets/10060411/3f5135ea-df2e-4288-bc85-f317e93cd6c0">

### Minimal reproduction project (MRP)

N/A
Repository: pytorch
Issue: Please implement the batching rule for torch.matrix_exp.
Labels: good first issue,triaged,actionable,module: functorch

### 🚀 The feature, motivation and pitch

Matrix exponentials are extremely expensive to compute, yet very important in many computing and ML problems . It would be great if such computational expensive functions can support batch implementations. Many thanks in advance for those who can help with this issue!



### Alternatives

_No response_

### Additional context

This below is the warning message from pytorch kernel: <ipython-input-13-6cfa90bb24a5>:3: UserWarning: There is a performance drop because we have not yet implemented the batching rule for aten::matrix_exp. Please file us an issue on GitHub so that we can prioritize its implementation. (Triggered internally at C:\cb\pytorch_1000000000000\work\aten\src\ATen\functorch\BatchedFallback.cpp:84.)

cc @zou3519 @Chillee @samdow @kshitij12345 @janeyx99
Repository: deno
Issue: Implement WebNN (Web Neural Network) API
Labels: suggestion

Draft Spec: https://www.w3.org/TR/webnn/

From the spec:
> At the heart of neural networks is a computational graph of mathematical operations. These operations are the building blocks of modern machine learning technologies in computer vision, natural language processing, and robotics. The WebNN API is a specification for constructing, compiling, and executing computational graphs of neural networks.

> The Web Neural Network API defines a web-friendly hardware-agnostic abstraction layer that makes use of Machine Learning capabilities of operating systems and underlying hardware platforms without being tied to platform-specific capabilities. The abstraction layer addresses the requirements of key Machine Learning JavaScript frameworks and also allows web developers familiar with the ML domain to write custom code without the help of libraries.

Explainer: https://github.com/webmachinelearning/webnn/blob/main/explainer.md

Example
```js
/* Computational graph 'C = A + B'. */
const operandType = { type: 'float32', dataType: 'float32', dimensions: [2, 2] };
const context = await navigator.ml.createContext();
const builder = new MLGraphBuilder(context);

const A = builder.input('A', operandType);
const B = builder.input('B', operandType);
const C = builder.add(A, B);

const graph = await builder.build({ 'C': C });

const bufferA = new Float32Array(4).fill(1.0);
const bufferB = new Float32Array(4).fill(1.0);
const bufferC = new Float32Array(4);

const inputs = { 'A': bufferA, 'B': bufferB };
const outputs = { 'C': bufferC };
const results = await context.compute(graph, inputs, outputs);

console.log(results.outputs.C); // [2, 2, 2, 2]
```
Repository: rust
Issue: rustdoc: Don't expand type aliases in inherent impls
Labels: T-rustdoc,C-enhancement,A-rustdoc-ui

Currently, rustdoc expands aliases when used as the type of an inherent implementation:

```rust
pub struct Foo<T>(T);
pub type Simple = Foo<()>;
impl Simple {
    pub fn xyz() {}
}
```

Generates:

![Screenshot 2023-12-17 at 08 07 08](https://github.com/rust-lang/rust/assets/3089613/3d447d51-51f2-43e8-98e3-1e83f6b8c6ae)

I expected to see `impl Simple` (especially since `Simple` is left unexpanded in function signatures).

@rustbot label +A-rustdoc-ui +C-enhancement
Repository: electron
Issue: [Bug]: globalShortcut Capslock prevent event default
Labels: bug :beetle:,has-repro-gist,28-x-y

### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a bug report that matches the one I want to file, without success.

### Electron Version

28.0.0

### What operating system are you using?

Windows

### Operating System Version

Windows 10 Pro 22H2 19045.3803

### What arch are you using?

x64

### Last Known Working Electron version

_No response_

### Expected Behavior

I'm registering this Caps lock as global shortcut

```js
const { app, globalShortcut } = require('electron/main')

app.whenReady().then(() => {
  let status = false

  const capsLock = globalShortcut.register('Capslock', () => {
    status = !status
    console.log(`CapsLock key is: ${status ? 'ON' : 'OFF'}`)
  })
}

app.on('will-quit', () => {
  globalShortcut.unregisterAll()
}
```

And I run the project with `npm run start` with the script `electron .`

The expected behavior is that show the console.log, but also that I can write letters using upper or lower case according to the CapsLock real state. 

### Actual Behavior

I'm expected show in the console the message, but also that when write, letters are in uppercase, but it still writing the letters in lowercase. Once I manually stop running the project with `ctrl+c` the CapsLock start working again as expected.

### Testcase Gist URL

https://gist.github.com/equiman/cb3e1ac31f41cf56c16c4abd0fdbf54c

### Additional Information

If I started the project once Caps Lock is enabled, then always write in upper case, even if I disable it the Caps Lock pressing the key.  Once I stop the project the Caps Lock works again.

For me is like is the `globalShortcut` is detecting the event but also prevent his default behavior or not letting to continue.

### Video

Video showing the problem, caps not work when is running, but works again when stop running the project.

![ezgif-2-1a0cb9e7d9](https://github.com/electron/electron/assets/933393/cb0a0969-4cf8-4536-bbe7-61185ff55fd0)
Repository: godot
Issue: SubViewport texture on mesh doesn't show on exported build unless render target set to update always
Labels: bug,topic:rendering,needs testing

### Tested versions

4.2.1

### System information

Windows 10, Vulkan, RTX 3060

### Issue description

SubViewport render textures give the error in editor:
```swift
_on_start_button_down(): Viewport Texture must be set to use it.
```
but display correctly in-game when run from the editor. Exported builds, however, totally break and just show black textures unless the render mode is set to Always.

https://github.com/godotengine/godot/issues/55471 addressed it, but was closed. It is still an issue, but hopefully these steps are useful enough to reproduce.

### Steps to reproduce

- Add a viewport material to a mesh and add a child Subviewport node
- set render target to something other than Always
- see the texture works in the game run from the editor
- export and see the texture is black in export build

### Minimal reproduction project (MRP)

N/A as this is a popular enough bug without needing me to make an example.
Repository: rust
Issue: Compiler can't unify arg-position `impl Trait` into an HRTB
Labels: A-lifetimes,A-trait-system,C-discussion,T-types,A-higher-ranked

It looks like using `arg: impl Trait` makes the compiler unable to generalize the entire function-type into HRTB (?), that is:
```rust
fn foo(_: &str) {
    //
}

fn bar(_: impl AsRef<str>) {
    //
}

fn zar<T>(_: T) {
    //
}

fn check(_: impl Fn(&str)) {
    //
}

fn main() {
    check(foo); // ok
    check(bar); // err (implementation not general enough)
    check(zar::<&str>); // err (ditto)
}
```
Using a no-op closure helps:
```rust
fn main() {
    check(|x| bar(x));
}
```
... but is somewhat inconvenient (spotted in the wild at https://github.com/clap-rs/clap/issues/4939).

Note that I'm reporting this is a bug, but I'm not really sure on the category here - it just feels like this code should pass type-checking, but maybe there's some deeper reason why it can't.
Repository: storybook
Issue: [Bug]: Module not found: Error: Can't resolve '/assets.png' in '/path/to/project/stories' although 'staticDirs' setting is correct
Labels: bug,has workaround,html,builder-vite

### Describe the bug

When using `html-webpack5` and importing html, absolute asset path in html cause the following error, although `staticDirs` setting is correct.
```
ERROR in ./stories/attachments.html 3:33-72
Module not found: Error: Can't resolve '/assets.png' in '/path/to/storybook-html-webpack5/stories'
 @ ./stories/Attachments.stories.js 1:0-38 5:33-37
 @ ./stories/ lazy ^\.\/.*$ include: (?:\/stories(?:\/(?%21\.)(?:(?:(?%21(?:^%7C\/)\.).)*?)\/%7C\/%7C$)(?%21\.)(?=.)[^/]*?\.stories\.(js%7Cjsx%7Cmjs%7Cts%7Ctsx))$ chunkName: [request] namespace object ./Attachments.stories.js ./Attachments.stories
 @ ./storybook-stories.js 23:11-27:5
 @ ./storybook-config-entry.js 6:0-50 25:21-29 28:2-31:4 28:58-31:3 30:31-39
```

### To Reproduce

1. Create html app as follows.
   ```zsh
   mkdir storybook-html-webpack5
   cd storybook-html-webpack5
   npm init
   # Choose all yes
   npx storybook@latest init -t html
   # Choose Webpack 5, then choose all yes
   ```
2. Add following lines to `.storybook/main.js`.
   ```js
     staticDirs: [
       "../stories/assets",
    ],
   ```
3. Add the following files.
   **`stories/attachments.html`**
   ```html
   <div class="attachments">
     <img srcset="/assets.png" style="max-width: 100px; max-height: 100px;" loading="lazy" src="/assets.png"/>
   </div>
   ```
   **`stories/Attachments.stories.js`**
   ```js
   import html from './attachments.html';
   
   export default {
     title: "Attachments",
   };
   
   export const Attachments = () => html;
   ```
4. Launch storybook.
   ```zsh
   npm run storybook
   ```

### System

```bash
System:
    OS: macOS 14.2
    CPU: (10) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.0 - ~/.asdf/installs/nodejs/18.18.0/bin/node
    Yarn: 1.22.19 - ~/.asdf/installs/nodejs/18.18.0/bin/yarn
    npm: 9.8.1 - ~/.asdf/plugins/nodejs/shims/npm <----- active
    pnpm: 8.7.5 - ~/.asdf/installs/nodejs/18.18.0/bin/pnpm
  Browsers:
    Chrome: 120.0.6099.109
    Safari: 17.2
  npmPackages:
    @storybook/addon-essentials: ^7.6.5 => 7.6.5 
    @storybook/addon-interactions: ^7.6.5 => 7.6.5 
    @storybook/addon-links: ^7.6.5 => 7.6.5 
    @storybook/blocks: ^7.6.5 => 7.6.5 
    @storybook/html: ^7.6.5 => 7.6.5 
    @storybook/html-webpack5: ^7.6.5 => 7.6.5 
    @storybook/test: ^7.6.5 => 7.6.5 
    storybook: ^7.6.5 => 7.6.5
```


### Additional context

When I changing `stories/Configure.mdx` as follows, the asset image (from `staticDirs`) was rendered correctly,
```diff
- <img src={Assets} alt="A representation of typography and image assets" />
+ <img src="/assets.png" alt="A representation of typography and image assets" />
```
so, I think that `staticDirs` setting is correct.

Also, when I using older Storybook 6.5.13 (in https://github.com/redmine-theme/storybook), the same use was no problem.
Repository: go
Issue: runtime/mainthread: new package to manage main thread
Labels: Proposal,Proposal-Accepted,compiler/runtime

**Update** The proposal is https://github.com/golang/go/issues/64777#issuecomment-2261119181.


### Proposal Details

This proposal is a less flexible but perhaps easier to implement and maintain alternative to #64755. See that issue for background and motivation for non-main packages to take control of the main thread.

I propose adding a new function, `runtime.RunOnMainThread`, for running a function on the startup, or main, thread. In particular,

```go
package runtime

// RunOnMainThread runs a function immediately after program initialization on a
// goroutine wired to the startup thread. It panics if called outside an init
// function, if called more than once, or if [runtime.LockOSThread] has already
// been called from an init function.
// Once RunOnMainThread is called, later LockOSThread calls from an init function
// will panic.
func RunOnMainThread(f func())
```

This is the complete proposal.

### Variants

Just like #64755, an alternative spelling is `syscall.RunOnMainThread` optionally limited to `GOOS=darwin` and `GOOS=ios`.
Repository: deno
Issue: deno-fmt: move imports to top, sort tailwind classes
Labels: upstream,deno fmt

I'm missing two formatting options which prettier solves via a plugin mechanism: 

1. [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss) is rather important for tailwind dx
2. move imports to top of file: in a large file, just past the import above the function you're working on, and on save it's at the top. It's more maintainable to have imports at the top.
Repository: stable-diffusion-webui
Issue: [Bug]: problems with SD after installing CUDA?
Labels: bug-report

### Checklist

- [X] The issue exists after disabling all extensions
- [X] The issue exists on a clean installation of webui
- [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
- [ ] The issue exists in the current version of the webui
- [X] The issue has not been reported before recently
- [ ] The issue has been reported before but has not been fixed yet

### OS

Windows 10

### What version did you experience this issue on?

SD 1.5

### What happened?

i have had this arguments before and SD was working fine

`
set COMMANDLINE_ARGS=--medvram --xformers --force-enable-xformers --always-batch-cond-uncond --opt-channelslast --no-hashing --disable-nan-check --api --xformers-flash-attention --opt-split-attention --no-half-vae
set PYTORCH_CUDA_ALLOC_CONF=garbage_collection_threshold:0.6, max_split_size_mb:32
`

i was downloading different versions of CUDA because i needed it for tensorflow project (i realised that tf doesnt work on win anymore) so i started running tf on WSL and now i have newest CUDA on my pc. 
After 2 months of not using SD i opened it again and tried to generate few picutes, i was getting this error (with args i mentioned above)

`RuntimeError: mat1 and mat2 must have the same dtype `

### NO ARGUMENTS
so i tried removing all arguments
then i can see in preview that image is generating but i get this output

NansException: A tensor with all NaNs was produced in Unet. This could be either because there's not enough precision to represent the picture, or because your video card does not support half type. Try setting the "Upcast cross attention layer to float32" option in Settings > Stable Diffusion or using the --no-half commandline argument to fix this. Use --disable-nan-check commandline argument to disable this check.
`
### ONLY --no-half IN ARGUMENTS
then i added  --no-half

![Snimka zaslona 2023-12-17 003601](https://github.com/invoke-ai/InvokeAI/assets/52748147/9d81f11e-ab17-45a9-ba0d-0768f8f6e98d)
after this picture i tried other sampling methods still the same (but with euler sampling i get: 
NansException: A tensor with all NaNs was produced in Unet. Use --disable-nan-check commandline argument to disable this check.)

###  --no-half-vae --no-half --disable-nan-check
now i try this arguents
`set COMMANDLINE_ARGS= --no-half-vae --no-half --disable-nan-check
`

![Snimka zaslona 2023-12-17 001557](https://github.com/invoke-ai/InvokeAI/assets/52748147/38f51e58-bc12-424d-8236-a1ce26da03bf)

i tried changing models, it did not fix problem, did upcast cross attention layer to float32" option in Settings i have the same generated pictures

GPU: RTX 3060 12GB Vram
every time i changed arguments i deleted venv
i also tried installing new nvidia drivers but now i tink --xformers doesnt work but that is not main problem
i also tried updating from 1.6.0 to 1.7.0 but did not help


### What browsers do you use to access the UI ?

Brave, i have tried with multiple browsers but i get the same issue