frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Show HN: Bonsplit – Tabs and splits for native macOS apps

https://bonsplit.alasdairmonk.com
153•sgottit•8h ago•22 comments

Show HN: TUI for managing XDG default applications

https://github.com/mitjafelicijan/xdgctl
94•mitjafelicijan•9h ago•30 comments

Show HN: AI-rganize – CLI tool for organizing your files

https://github.com/adefemi171/ai-rganize
2•tha_infra_guy•23m ago•0 comments

Show HN: Fence – Sandbox CLI commands with network/filesystem restrictions

https://github.com/Use-Tusk/fence
37•jy-tan•5d ago•9 comments

Show HN: A Zero-Copy 1.58-bit LLM Engine hitting 117 Tokens/s on single CPU core

https://github.com/r3-engine/r3-engine
2•dhilipsiva•50m ago•0 comments

Show HN: Accurate Password Guessing with AI

https://github.com/Tzohar/PassLLM
2•Plarsy•57m ago•0 comments

Show HN: Netfence – Like Envoy for eBPF Filters

https://github.com/danthegoodman1/netfence
33•dangoodmanUT•5h ago•6 comments

Show HN: LLMNet – The Offline Internet, Search the web without the web

https://github.com/skorotkiewicz/llmnet
14•modinfo•6h ago•3 comments

Show HN: I used my book generator to generate a catalog of books it can generate

https://www.ebook-forge.com/Omni
2•lywald•1h ago•2 comments

Show HN: Uv-pack – Pack a uv environment for later portable (offline) install

https://github.com/davnn/uv-pack
3•davnn•1h ago•0 comments

Show HN: Kreamsicle – Cmd+K command palette for Hacker News

https://sajarin.com/blog/kreamsicle/
3•Sajarin•2h ago•2 comments

Show HN: AutoShorts – Local, GPU-accelerated AI video pipeline for creators

https://github.com/divyaprakash0426/autoshorts
63•divyaprakash•13h ago•32 comments

Show HN: CertRadar – Find every certificate ever issued for your domain

https://certradar.net/
4•ops_mechanic•2h ago•2 comments

Show HN: I Created a Tool to Convert YouTube Videos into 2000 Word SEO Blog

https://landkit.pro/youtube-to-blog
2•nikhonit•2h ago•0 comments

Show HN: Sightline – Shodan-style search for real-world infra using OSM Data

https://github.com/ni5arga/sightline
18•ni5arga•12h ago•0 comments

Show HN: C From Scratch – Learn safety-critical C with prove-first methodology

https://github.com/SpeyTech/c-from-scratch
55•william1872•20h ago•8 comments

Show HN: Bucket – Encrypted file sharing for people who live in the terminal

https://bucketlabs.org
4•bucket_•4h ago•3 comments

Show HN: Generate the perfect kickoff prompt

https://vibeprompting.dev
2•relatedcode•5h ago•0 comments

Show HN: Open-source Figma design to code

https://github.com/vibeflowing-inc/vibe_figma
49•alepeak•1d ago•8 comments

Show HN: Open Computer-Animated Multivariable Calculus Course in 6 Languages

https://calculus.academa.ai/
4•sinaatalay•5h ago•2 comments

Show HN: Free PDF Editor by TechRex – client-side PDF editing, OCR, compression

https://pdffreeeditor.com/
3•Maaz-Sohail•5h ago•0 comments

Show HN: AI powered daily tracker of the US slide into authoritarianism

https://www.worstdaysofar.com/
5•locallyoptimal•5h ago•0 comments

Show HN: Coi – A language that compiles to WASM, beats React/Vue

214•io_eric•5d ago•68 comments

Show HN: StormWatch – Weather emergency dashboard with prep checklists

https://jeisey.github.io/stormwatch/
43•lotusxblack•1d ago•11 comments

Show HN: Timer-wheel–based TTL cache for Node.js

https://github.com/m-thenot/tick-cache
2•mtht•6h ago•0 comments

Show HN: VM-curator – a TUI alternative to libvirt and virt-manager

https://github.com/mroboff/vm-curator
36•theYipster•17h ago•7 comments

Show HN: RealXV6 – a faithful Unix V6 kernel port to 8086 real mode

https://github.com/FounderSG/RealXV6
5•FounderSG•4h ago•0 comments

Show HN: HomeGenGuide – Calculator for home generator installation costs

https://www.home-generator-installation.com
3•vansxxx•7h ago•0 comments

Show HN: isometric.nyc – giant isometric pixel art map of NYC

https://cannoneyed.com/isometric-nyc/
1304•cannoneyed•3d ago•240 comments

Show HN: Waves – Terminal music player with download, tagging, and library

https://github.com/llehouerou/waves
2•llehouerou•7h ago•0 comments
Open in hackernews

Show HN: (bits) of a Libc, Optimized for Wasm

https://github.com/ncruces/go-sqlite3/tree/main/sqlite3/libc
78•ncruces•9mo ago
I make a no-CGO Go SQLite driver, by compiling the amalgamation to Wasm, then loading the result with wazero (a CGO-free Wasm runtime).

To compile SQLite, I use wasi-sdk, which uses wasi-libc, which is based on musl. It's been said that musl is slow(er than glibc), which is true, to a point.

musl uses SWAR on a size_t to implement various functions in string.h. This is fine, except size_t is just 32-bit on Wasm.

I found that implementing a few of those functions with Wasm SIMD128 can make them go around 4x faster.

Other functions don't even use SWAR; redoing those can make them 16x faster.

Smooth sort also has trouble pulling its own weight; a Shell sort seems both simpler and faster, while similarly avoiding recursion, allocations and the addressable stack.

I found that using SIMD intrinsics (rather than SWAR) makes it easier to avoid UB, but the code would definitely benefit from more eyeballs.

See this for some benchmarks on both x86-64 and Aarch64: https://github.com/ncruces/go-sqlite3/actions/runs/145169318...

Comments

phickey•9mo ago
This looks like a nice approach to making wasi-libc faster. Could you submit these changes upstream?
ncruces•9mo ago
I'd like to be a little more sure that I'm not totally messing things up before doing that, but yes, eventually, that would be a nice outcome.

I've also only really tested wazero. I can't know for sure that this is a straight improvement for other runtimes and architectures.

For instance, the code delays using wasm_i8x16_bitmask as much as possible, because on Aarch64 it can be slower than not using SIMD at all, whereas it's plenty fast on x86-64.

phickey•9mo ago
The maintainers of wasi-libc are some of the best people to review this, and I don’t think it would be wasting their time to ask them to look at a PR.
ncruces•9mo ago
A PR is a significant investment from me. I'd have to figure out where something like this is supposed to fit, how the build infra works, etc.

One of the nice things about Go is how much that's a solved issue out of the box, compared to almost everything else; certainly compared to C.

Pinging them in an issue: https://github.com/WebAssembly/wasi-libc/issues/580

nu11ptr•9mo ago
It is still a bit early, but I'm majorly bullish on WASM for multiple use cases:

1. Client side browser polyglot "applets" (Java applets were ahead of their time IMO)

2. Server side polyglot "servlets" (Node.js, embedded runtimes, etc.)

3. Language interop/FFI (Lang A -> WASM -> Lang B, like wasm2c)

Why is #3 so interesting? The hardest thing in language conversion is the library calls. WASI standardizes that, so all the proprietary libs will eventually compile down to WASI as a sort of POSIX/libc like layer. In addition, WASM standardizes calling convention. The resulting new source code may not look like much, but it will solve the FFI calling convention/marshalling/library issues nicely.

frumplestlatz•9mo ago
I’m not sure how it solves the FFI problem. Lowest common denominator calling conventions don’t make it any easier to bridge languages than it already is.

C calling conventions are already the standard for FFI in native code, and that means dropping down to what can be expressed in C if you want to cross that boundary.

ncruces•9mo ago
As far as Go is concerned, the Wasm sandbox makes the (addressable, C) stack explicit, which solves at least some of the issues CGO has to deal with.

It's not a panacea, though; it introduces other issues.

fuhsnn•9mo ago
Wasm intrinsics look neat as a higher-level fixed size SIMD abstraction. I wonder how good the compilers can do if using them for AOT targets with libraries like simd-everywhere.

string.h is missing strstr(), there's an algorithm of similar complexity you might consider: http://0x80.pl/notesen/2016-11-28-simd-strfind.html

ncruces•9mo ago
Yeah, so far I did exactly the ones (my build of) SQLite needed and not others.

If there's interest, the set of implemented functions can definitely be extended.

cedws•9mo ago
Would you consider writing some blog posts or other resources about WASM? I was experimenting recently with WIT, and ran into a mountain of issues. There's a lot of jargon that could do with some untangling.

It took me a lot longer than it should have to put together this basic module, and even then there's this shared library I had to download to build it, and I couldn't figure out why this requires a libc:

https://github.com/cedws/wasm-wit-test

ncruces•9mo ago
I'm not that great at long form writing to be honest, it's always a bit of a chore, and I'm never happy with the result.

To answer your question, it needs a libc because you're including stdlib.h, and exporting and allocator (even if you're not otherwise using it). You need a libc for malloc.

This is generally a good idea, if you need to send anything beyond numbers across the API (e.g. you need an allocator if you want to send strings as pointers).

I never used WIT, so I have no idea if this a requirement for WIT.

cedws•9mo ago
Ah ok. Thanks!
forrestthewoods•9mo ago
What is SWAR?
ncruces•9mo ago
SIMD within a register: https://en.wikipedia.org/wiki/SWAR

It's generally used for techniques that apply SIMD principles within general-purpose registers and instructions.

Assume you've loaded a 64-bit register (a uint64_t) with 8 bytes (unsigned char) of data. Can you answer the question “is any of these 8 bytes zero (the NUL terminator)?”

If you find a cheap way to do it, you can make strlen go faster by consuming 8 bytes at a time.

Et voilà:

   #define ONES ((uint64_t)-1/UCHAR_MAX)
   #define HIGHS (ONES \* (UCHAR_MAX/2+1))
   #define HASZERO(x) ((x)-ONES & ~(x) & HIGHS)
forrestthewoods•9mo ago
TIL, thanks!
tuananh•9mo ago
very cool project.

it's kinda frustrating to compile sqlite for wasm. can be done but quite troublesome.