Skip to content

Instantly share code, notes, and snippets.

View pavelsavara's full-sized avatar
💭
🍀 Life is good

Pavel Savara pavelsavara

💭
🍀 Life is good
View GitHub Profile
@pavelsavara
pavelsavara / gist:f4110594efaeb97865a729d0e88dcf2f
Created January 4, 2017 17:38
C++ version of multi-set ranking for small multisets
#pragma once
#include "stdafx.h"
namespace multiset {
typedef uint8_t byte;
class FindMultisetRank
{
private:
@page "/"
@using System.Diagnostics;
@using System;
@using System.Timers;
@inject IJSRuntime JS
<PageTitle>Index</PageTitle>
<p>
<button @onclick="Test">Test</button>
@page "/"
@using System.Diagnostics;
@using System;
@using System.Timers;
@inject IJSRuntime JS
<PageTitle>Index</PageTitle>
<p>
<button @onclick="Test">Test</button>
@pavelsavara
pavelsavara / Multi-threading-browser-design-details.md
Created May 14, 2024 10:05
Multi-threading on a browser - details discovered during initial design

Alternatives - as considered 2023 Sep

  • how to deal with blocking C# code on UI thread
    • A) pretend it's not a problem (this we already have)
    • B) move user C# code to web worker
    • C) move all Mono to web worker
    • D) like A) just move call of the C# Main() to JSWebWorker
  • how to deal with blocking in synchronous JS calls from UI thread (like onClick callback)
    • D) pretend it's not a problem (this we already have)
    • E) throw PNSE when synchronous JSExport is called on UI thread
  • F) dispatch calls to synchronous JSExport to web worker and spin-wait on JS side of UI thread.
@pavelsavara
pavelsavara / wasm-duty.md
Created July 12, 2024 10:19
WASM build duty rotation

How to

Check new issues that need triage

  • untriaged wasm issues
  • Try to guess which release it belongs to. If you don't know assign current.
  • Assign them to specific team member. If you don't know, assign @lewing

Check Known Build Errors

public class Prog
{
static void TimerHandler(object _)
{
Console.WriteLine("TimerHandler A");
}
static void SetNextTimer()
{
(func $Wasm_Advanced_Sample_Sample_Test_SillyLoop (;13707;) (param $var0 i32)
(local $var1 i32)
(local $var2 i32)
(local $var3 i32)
(local $var4 i32)
(local $var5 i32)
global.get $__stack_pointer
i32.const 144
i32.sub
local.tee $var1

Thread A, producer

const memory = new SharedArrayBuffer(16);

// produce 100 items and wake consumer after each 
for (let i = 0;i<100;i++){
    // wait for consumer to say it's ready
    Atomics.wait(memory, 0);