Commit Graph

10 Commits

Author SHA1 Message Date
Namekuji
e3e0073334 add cargo test script 2023-06-03 00:40:51 -04:00
Namekuji
2f0629b42b cargo formats all modules 2023-06-03 00:37:10 -04:00
Namekuji
1279f396a6 add unit test 2023-06-02 23:48:27 -04:00
Namekuji
3bfb1a0cf0 add format script 2023-06-02 23:48:27 -04:00
Namekuji
af85304578 add native calls 2023-06-02 23:48:24 -04:00
Namekuji
3af4a86254 use schema in native-utils 2023-06-02 23:48:24 -04:00
Namekuji
516d5460f0 fix varchar array 2023-06-02 23:48:18 -04:00
Namekuji
f851bc8f40 rename test modules 2023-06-02 23:48:17 -04:00
Namekuji
4e4280e02e add tests 2023-06-02 23:48:17 -04:00
s1idewhist1e
981d3ee725 Refactor: use rust for native mastodon id conversion (#9786)
This uses [napi-rs](https://napi.rs/) to allow for automatic generation of node bindings for the native code.

I also changed the `isolatedModules` TS flag to false to allow for `static enum` to be shared across modules. It doesn't seem to be necessary for the build system that CK uses.

Currently this method does not work with ID generators with longer IDs. Likely the best solution is to add another key in the database.

Some benchmarks for 1 million conversions:

```
	node, x1_000_000: 2.847s
	rust, x1_000_000: 1.265s
```

There are still optimizations that can be made, but I think this is a good starting point and a good way to bring rust into the CK stack.

Co-authored-by: s1idewhist1e <trombonedude05@gmail.com>
Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9786
Co-authored-by: s1idewhist1e <s1idewhist1e@noreply.codeberg.org>
Co-committed-by: s1idewhist1e <s1idewhist1e@noreply.codeberg.org>
2023-03-31 01:58:28 +00:00