Commit Graph

47 Commits

Author SHA1 Message Date
Jarred Sumner
69eedb4c92 use write$NOCANCEL, more logging 2022-11-13 21:57:14 -08:00
Jarred Sumner
ed5595f792 Add a stub for io_darwin on linux
cc @sno2 hopefully this helps but i'm not sure
2022-10-27 18:26:32 -07:00
Jarred Sumner
a114af4eea Use write() and read() since not every file type supports positional 2022-10-10 20:59:34 -07:00
Jarred SUmner
e14a3af491 Fix linux build 2022-09-22 03:25:29 -07:00
Jarred Sumner
ce9daa4857 1 event loop per thread. Instead of 3.
uWebSockets and uSockets will need to be upgraded to match the changes.

Previously:
- Bun had a separate kqueue/eventfd just for async wakeups.
- Bun had a separate kqueue/epoll just for reading files non-blocking in the same thread

This commit unifies it into one event loop per thread
2022-09-22 02:25:32 -07:00
Jarred Sumner
b78b36ce33 Fix build issue on Linux? 2022-09-11 15:01:57 -07:00
Jarred Sumner
9a5aa059f9 New HTTP client (#1231)
* wip

* It mostly works!

* Support `bun install`

* Support `bun create`

* Support chunked transfer encoding

* Handle Keep Alive when redirecting to a different domain

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-09-11 13:37:17 -07:00
Jarred Sumner
c1734c6ec5 More reliable macOS event loop (#1166)
* More reliable macOS event loop

* Reduce CPU usage of idling

* Add another implementation

* Add benchmark

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-08-28 21:28:05 -07:00
Zilin Zhu
e6a1209c53 Fix clearTimeout and linux timeout (#1138) 2022-08-24 09:12:20 -07:00
Jarred Sumner
e210f271bb Fix macOS build 2022-08-13 21:58:31 -07:00
Jarred SUmner
0815c83974 Improve event loop reliability on Linux 2022-08-13 06:07:18 -07:00
Jarred Sumner
43de33afc7 Web Streams API (#176)
* [bun.js] `WritableStream`, `ReadableStream`, `TransformStream`, `WritableStreamDefaultController`, `ReadableStreamDefaultController` & more

* Implement `Blob.stream()`

* Update streams.test.js

* Fix sourcemaps crash

* [TextEncoder] 3x faster in hot loops

* reading almost works

* start to implement native streams

* Implement `Blob.stream()`

* Implement `Bun.file(pathOrFd).stream()`

* Add an extra function

* [fs.readFile] Improve performance

* make jsc bindings a little easier to work with

* fix segfault

* faster async/await + readablestream optimizations

* WebKit updates

* More WebKit updates

* Add releaseWEakrefs binding

* `bun:jsc`

* More streams

* Update streams.test.js

* Update Makefile

* Update mimalloc

* Update WebKit

* Create bun-jsc.test.js

* Faster ReadableStream

* Fix off by one & exceptions

* Handle empty files/blobs

* Update streams.test.js

* Move streams to it's own file

* temp

* impl #1

* take two

* good enough for now

* Implement `readableStreamToArray`, `readableStreamToArrayBuffer`, `concatArrayBuffers`

* jsxOptimizationInlining

* Fix crash

* Add `jsxOptimizationInline` to Bun.Transpiler

* Update Transpiler types

* Update js_ast.zig

* Automatically choose production mode when NODE_ENV="production"

* Update cli.zig

* [jsx] Handle defaultProps when inlining

* Update transpiler.test.js

* uncomment some tests

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-06-07 22:32:46 -07:00
Jarred Sumner
f6d73cb06e [bun.js] Implement Bun.sha1, Bun.sha256, Bun.sha384, Bun.sha512, Bun.sha512_384 2022-04-12 22:59:52 -07:00
Jarred Sumner
daeede28db [bun dev] Fix segfaults 2022-04-05 06:38:36 -07:00
Jarred SUmner
30542225c6 fix bug with io sometimes sleeping permanetly 2022-04-04 23:25:54 -07:00
Jarred SUmner
5e5f0bd293 [bun.js] Implement Bun.write() 2022-03-23 01:46:47 -07:00
Jarred SUmner
6e9be9f1cc Linux-specific tweaks 2022-03-22 02:55:28 -07:00
Jarred Sumner
fa343fa8ad [bun.js] 1/? Implement Response.file 2022-03-21 02:21:51 -07:00
Jarred SUmner
6bcaa33751 Fix setTimeout on Linux 2022-03-16 08:02:15 -07:00
Jarred Sumner
114c0e8ed2 [bun.js] Implement setTimeout, setInterval, clearTimeout, clearInterval 2022-03-01 00:47:31 -08:00
Jarred Sumner
50560e169c WASM 2022-02-27 23:20:10 -08:00
Jarred SUmner
860d7e93c0 Make bun-install slower but more reliable on Linux Kernel 5.5 and lower 2022-02-05 00:26:58 -08:00
Jarred Sumner
45e7bb0027 IO.Completion.slice() 2022-02-01 16:23:02 -08:00
Jarred Sumner
bfa2bc6736 merge 2022-01-25 20:04:24 -08:00
Jarred SUmner
333bccee5d On successful connect, switch to non-blocking sockets until we're about to close 2022-01-25 00:17:14 -08:00
Jarred SUmner
25c35e59b4 Fix getsockopt() 2022-01-25 00:00:16 -08:00
Jarred SUmner
ff7785e023 Automatically retry on would block 2022-01-24 23:42:16 -08:00
Jarred SUmner
0e138bcc8f Fallback to readev / writev 2022-01-24 23:30:23 -08:00
Jarred Sumner
61d1c7b6b2 Update io_linux.zig 2022-01-23 23:11:41 -08:00
Jarred Sumner
b5cec4b704 [linux][http] return errno instead of unexpected 2022-01-23 23:11:06 -08:00
Jarred Sumner
e895605e5f [http] Remove usages of unreachable in syscall error handling 2022-01-23 23:06:44 -08:00
Jarred Sumner
f5a79ea6d2 Update io_linux.zig 2022-01-23 23:03:04 -08:00
Jarred Sumner
de0cf42111 Use non-cancellable syscalls for HTTP & use errno for errors 2022-01-23 23:00:15 -08:00
Jarred Sumner
ae5e2f5af2 Update io_linux.zig 2021-12-30 22:09:51 -08:00
Jarred Sumner
a8b7b2a6b9 Update io_linux.zig 2021-12-30 22:08:14 -08:00
Jarred Sumner
111bef7f06 _ => . 2021-12-30 22:06:45 -08:00
Jarred Sumner
6f1c6fbc1a - => . 2021-12-30 22:05:44 -08:00
Jarred Sumner
ed71379aa1 linux 2021-12-30 22:04:26 -08:00
Jarred Sumner
e75c711c68 Upgrade to latest Zig, remove dependency on patched version of Zig (#96)
* Prepare to upgrade zig

* zig fmt

* AllocGate

* Update data_url.zig

* wip

* few files

* just headers now?

* I think everything works?

* Update mimalloc

* Update hash_map.zig

* Perf improvements to compensate for Allocgate

* Bump

* 📷

* Update bun.lockb

* Less branching

* [js parser] Slightly reduce memory usage

* Update js_parser.zig

* WIP remove unused

* [JS parser] WIP support for `with` keyword

* Remove more dead code

* Fix all the build errors!

* cleanup

* Move `network_thread` up

* Bump peechy

* Update README.md
2021-12-30 21:12:32 -08:00
Jarred Sumner
9160c9ae31 Fix spawning child bun processes 2021-12-22 21:37:33 -08:00
Jarred Sumner
005a0ec931 Update io_darwin.zig 2021-12-22 19:10:41 -08:00
Jarred Sumner
2cfdf29364 Fix error from requesting too much from io_uring 2021-12-22 19:05:39 -08:00
Jarred Sumner
809c1e46d8 [npm install] starting to look good! 2021-12-16 19:18:51 -08:00
Jarred Sumner
9f1946ce70 [npm install] Use BoringSSL for https:// requests 2021-12-16 19:18:51 -08:00
Jarred SUmner
e331ebbf7d [bun install] Linux async http 2021-12-16 19:18:51 -08:00
Jarred Sumner
b1660fa468 [bun install] async http request works I think? 2021-12-16 19:18:51 -08:00
Jarred Sumner
4af743766d [bun install] Begin to add io_uring (via tigerbeetle/@kprotty's interface) 2021-12-16 19:18:51 -08:00