Skip to content

Commit

Permalink
reference orbitを40倍速く計算できるrust clientを使えるようにした (#50)
Browse files Browse the repository at this point in the history
* Install ws

* Install tsx

* ChatGPTを頼りに作るwebsocket server/client

* 計算クライアントとして登録できるようにした

* エラー処理とかログとか追加

* blaTableは返さない

* 計算用クライアントから値を受け取れるようになった

が盛大に描画結果がぶっ壊れている

* zeroが抜けてた

* rust -> jsはJSONを経由するオーバーヘッドを減らすためバイナリで送る

* NODE_ENVを読めるようにしておく

* windows向けにcross-envしておく

* websocketつなぐ部分を別メソッドに切り出した

* 1回接続に失敗したらworker上での計算にfallbackする

* 毎回ではなくworker立ち上げ時にwebsocket接続する

* 途中で切断した場合などに対応

* README追加

* 邪魔

* なんか謎に2回wrapしてしまっていたのを修正

* workerの切り替え時にWebSocketを閉じるようにした
  • Loading branch information
k-chop authored Jan 9, 2025
1 parent bd19d66 commit 8fb3bd4
Show file tree
Hide file tree
Showing 13 changed files with 1,453 additions and 249 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"dev": "cross-env NODE_ENV=development vite",
"build": "cross-env NODE_ENV=production tsc && vite build",
"preview": "vite preview",
"test": "vitest"
"test": "vitest",
"server": "tsx src/server/index.ts"
},
"devDependencies": {
"@radix-ui/colors": "2.1.0",
Expand All @@ -20,12 +21,15 @@
"@types/p5": "1.7.6",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"@types/ws": "8.5.12",
"@vitejs/plugin-react": "4.2.1",
"autoprefixer": "10.4.19",
"cross-env": "7.0.3",
"postcss": "8.4.38",
"prettier": "3.2.5",
"prettier-plugin-tailwindcss": "0.5.14",
"tailwindcss": "3.4.3",
"tsx": "4.19.0",
"typescript": "5.4.5",
"vite": "5.2.11",
"vitest": "1.5.3",
Expand Down Expand Up @@ -61,6 +65,7 @@
"react-dom": "18.3.1",
"react-promise-suspense": "0.3.4",
"tailwind-merge": "1.14.0",
"tailwindcss-animate": "1.0.7"
"tailwindcss-animate": "1.0.7",
"ws": "8.18.0"
}
}
Loading

0 comments on commit 8fb3bd4

Please sign in to comment.