7bd484b9Rewrite WS connection and messaging in Vala (GLib)
The added overheads, especially cognitive overhead, had been bothering
me long time. Communicating via plain C FFI also means the Zig part has
to take care of thread-safety *outside of* GLib main-loop, which comes
with noticeable performance penalty.
By implementing (almost) everything in Vala, thread unsafety and
performance penalty caused by locking have gone. Browser navigations are
much quicker and I'm yet to see a single unresponsed request.
JSON serializing and deserializing module is the only remaining Zig
code. Although I'd much like to this part to Vala as well, JSON handling
in Vala is horrible shit so I doubt the migration will happen in a
foreseeable future.
This patch just replaces the C API (in Zig) by Vala counterpart. I did
not application restructure or refactor or whatever. Those will make
this patch more difficult to view. The only difference (regression?) is
the connection object cannot withstand WebSocket connection closing.
However, in my limited testing, libsoup seems to keep WebSocket
connection even when computer is sleeping... so the chance of
disconnection will be lower than before therefore that's not a huge
problem.
Shota FUJI
authored at
Shota FUJI
comitted at
23e3c3b1Fix constructor functions for seriealizer use uint8[] rather than string
Shota FUJI
authored at
Shota FUJI
comitted at
1f8846d0JSON API for register request and response
This got individual commit because the request needs additional change
to API builder code.
Shota FUJI
authored at
Shota FUJI
comitted at
798ecc52Create Roon request and response handle library in Zig
Vala's (GTK ecosystem's) JSON parsing is dogshit.
Although I'd like to write an entire codebase in Vala, this is necessary
to maintain readability and quality.
This commit only contains browse request/response for brevity.
Shota FUJI
authored at
Shota FUJI
comitted at
6c1c34edCreate helper class for body extracting
This does not have actual JSON parsing, as parsing JSON in Vala is
totally mess, nightmare.
The only (?) seemingly-reliable library is json-glib. Documentation is
unorganized mess as usual in GTK-related project, so it does not dismiss
the value. Extremely imperative and quite verbose API is tolerable if
it's used for rare case such as string-to-enum conversion. The problem
is the library is not well integrated GLib ecosystem, despite it being
under GLib project. It has GObject serialization and deserialization
functionality, and they are bare minimum. No array support, top-level
MUST be an object... Imperative API also is full of footgun, such as
getting a data from node in mismatching type returns "NULL" or "0"...
In addition to that, I see no mention of "null or field omit" in methods
I checked.
That may okay as a C library, but definetely does not meet a quality
required to be used in high-level languages, Vala.
Little bit cumbersome, but seriealize and deserialize in Zig via FFI is
much much much cleaner and better. Considering how widespread JSON is, I
can't recommend Vala as a sole application development language to
anyone, especially the application involves networking. For GTK
application development, Rust would be the best choice nowadays?
Shota FUJI
authored at
Shota FUJI
comitted at
e2d16abdCreate MOO metadata parser in Vala
The first and primary reason is better integration to GTK ecosystem.
GObject, GString (null-terminated strings,) GError, etc... Bridging Zig
(or any other system language with C API export) to those are tedious
and error-prone task. If the extra allocations (copy) are necessary due
to the fucking null-terminated strings, why not writing the whole logic
in Vala? The burden of bridges outweighs the ergonomics of using Zig
with copy-every-string approach.
The second reason is I wanted to see what is like to write non-GUI code
in Vala, including unit testing. It turns out really bad, because of
null-terminated fucking string and lack of converting it to/from length
specified bytes.
Shota FUJI
authored at
Shota FUJI
comitted at
2c27fac8Extract Vala compilation step to individual file
I was trying to configure unit testing for Vala, but it was too
repetitive writing same "addSystemCommand" step.
This struct style is much cleaner and self-descriptiveto.
Shota FUJI
authored at
Shota FUJI
comitted at
f0733ed4Extract new core classes to individual files
It was really difficult to read or modify code due to lack of per-file
isolation (relying on manual namespacing.)
Shota FUJI
authored at
Shota FUJI
comitted at
9dfa25f8Remove unused file
modulemap is for using C API inside Swift (Xcode?)
Shota FUJI
authored at
Shota FUJI
comitted at
52424bbaMigrate server discovery to Vala
For tighter integration and make the whole app GLib-y.
Shota FUJI
authored at
Shota FUJI
comitted at
65062858Format Vala files
It seems changes to "uncrustify.cfg" has not been read by dprint.
Temporarily set "cacheKey" then reran, now every Vala files are
formatted.
Shota FUJI
authored at
Shota FUJI
comitted at
bbf35e5bArtwork download logic in Vala
I'd like to have most of logics in GTK-style. It technically is possible
to do in Zig, but doing that in Vala is more straightforward and
requires less effort, I guess.
As a result, overall display speed massively improved.
Shota FUJI
authored at
Shota FUJI
comitted at
e10485b3Use GListView instead of GListBox
This improves rendering performance.
Although this reverts "action menu" UI, I believe this is better and
easier to use. Plac for macOS has been using this "everything is list"
style and I prefer this over the popup menu.
Shota FUJI
authored at
Shota FUJI
comitted at
bc7b89c0Merge core/ and gtk-adwaita/ directories
There are no other package using core/ anymore.
Shota FUJI
authored at
Shota FUJI
comitted at
06b251d3Remove code related to CLI
I no longer use it. Memory errors should be tested with unit tests
and/or integrated tests using mock server.
Shota FUJI
authored at
Shota FUJI
comitted at
a363d624Remove code related to macOS client
Client application for Apple devices now has dedicated repository.
https://codeberg.org/pocka/plac-for-apple-platform
Shota FUJI
authored at
Shota FUJI
comitted at