HNHacker News
TopNewBestAskShowJobs

gudzpoz

617 karma · joined July 1, 2022

nobody

blog: https://kyo.iroiro.party/en/

submissionscomments
gudzpoz··on Show HN: Thread – AI-powered Jupyter Notebook built using React
The GIFs look good and I like how it lets the user diff between original code and AI-generated ones. But still, I would like to quote from an article on Thread (well, this Thread is a network stack) [1]:

> No, seriously. Can we please not name new things using terms that are already widely used? I hate that I have to specify whether I’m talking about sewing, screwing, parallel computing, a social network from Meta, or a networking stack. Stop it.

[1] https://overengineer.dev/blog/2024/05/10/thread/#user-conten...

gudzpoz··on GNU Justified Public License

    git diff -U --word-diff --no-index -- <(curl -s https://www.gnu.org/licenses/gpl-3.0.txt) <(curl -s https://tom7.org/bovex/JCOPYING)
It seems some sentences are totally trimmed off though. But otherwise it is really a sweet, sweet eye candy.
gudzpoz··on Llama-3-V model was plagiarized from MiniCPM
Posted 10 hours ago:

Llama3V is suspected to have been stolen from the MiniCPM-Llama3-v2.5 project - https://news.ycombinator.com/item?id=40559746 (6 comments)

gudzpoz··on Low-latency scripting for game engines
> ... but Lua still creates issues now and then. Like if you forget return, the return value is that of the last expression.

Is this true? Or was it true for some Lua 2.X versions? Because it does not seem to be the case for Lua 3.0 and on: [1]

> If control reaches the end of a function without a return instruction, then the function returns with no results.

As to the idea of using an emulator for scripting, it seems a bit similar to approaches using WebAssembly. But looking into the benchmarks [2] provided by libriscv, it is quite interesting to see it outperforms luajit and wasm3 (in its "hand-picked" tests, at the very least).

[1] https://www.lua.org/manual/3.0/manual.html [2] https://github.com/fwsGonzo/libriscv?tab=readme-ov-file#benc...

gudzpoz··on How to Use the Foreign Function API in Java 22 to Call C Libraries
There is a library called jnigen [1], mainly used by the libGDX framework [2]. But I don't see it used in many other projects though. Personally I use it to maintain a set of Lua C API bindings for some platforms [3] and it works sort of OK once you manage to somehow set up a workflow for building and testing the binaries.

> It works but it is a pain if anything ever changes or a new platform needs to be brought up. Checking in binaries always feels icky but is necessary if not all targets can be built on a single machine.

It is definitely a pain when you cannot test all changes on a single local machine. But I would argue that it is true whenever multiple platforms (or maybe even multiple glibc versions) are involved, regardless of what languages/libraries/tools you use.

[1] https://libgdx.com/wiki/utils/jnigen [2] https://github.com/libgdx/libgdx [3] https://github.com/gudzpoz/luajava

gudzpoz··on Why choose async/await over threads?
I think the author is confusing two things here:

1. User-space threads / Green threads

2. Structured concurrency

The former one is an advantage of async/await, but is not unique to it (see Go or Java Loom for examples that involves no function coloring problem). And the latter one can be implemented with both OS threads and green threads (see Structured concurrency JEPS for Java [1]).

[1] https://openjdk.org/jeps/462

gudzpoz··on Show HN: jnv: interactive JSON filter using jq
If you use Emacs, there is also jq-mode. But jnv's filter auto-completion is really a killer feature for me.

[1] https://github.com/ljos/jq-mode

gudzpoz··on Freenginx: Core Nginx Developer Announces Fork of Popular Web Server
> “Nginx is an incredible software and platform, but I was wondering if it wouldn't be time to just bite the bullet and create a more modern solution based on Rust.”

I actually don't understand why I am seeing arguments like this all the time. Rewrite takes time and effort. It may be OK for new projects. But for a mature project that has a quarter million lines of code and load-tested for cross-platform compatibility and security, it is way more than "just biting the bullet". (Not to mention that memory safety in Rust is ... still improvable. [1])

Rust is not a panacea. [2] When a corporate tries to seize control of a open source project, some one (or some entity?) has to do something, and rewriting in Rust by no means reclaims the freedom and openness of the project.

[1] https://news.ycombinator.com/item?id=39440808

[2] https://ariadne.space/2023/12/07/most-breaches-actually-begi...

gudzpoz··on Experimenting with GC-less (heap-less) Java
For benchmarks it is generally recommended to use JMH [1] instead of coding your own warm-up, timing & GC profiling implementation. Playing around with a quick JMH set-up [2], there are a few new findings though:

    | Benchmark | Count | Preallocate | Time (ns/op) | Allocation (B/op) | Allocation (op)     |
    |-----------+-------+-------------+--------------+-------------------+---------------------|
    | OnHeap    |  10^6 | true        |      6231838 |          16000020 | ~ 1                 |
    | OffHeap   |  10^6 | true        |      6819142 |                54 | Should also be ~ 1  |
    | OnHeap    |  10^6 | false       |      9719988 |          33554598 | ~ 17                |
    | OffHeap   |  10^6 | false       |     19450448 |               773 | Should also be ~ 17 |
1. The difference between on/off-heap Python-like implementation is less significant (~ 10%) provided that we preallocate things correctly.

2. The off-heap (MemorySegment) implementation slows down as the number of allocation increasing.

EDIT: Profiling with JMH (using -prof async) shows that the off-heap implementation spent quite some time on jdk.internal.misc.Unsafe.getIntUnaligned in its resizeIfNeeded method, which should be the culprit here - Java array are guaranteed to be aligned (at least in HotSpot JVM), and aligned operations are much more efficient than unaligned ones, which should be able to explain the performance hit.

    --- 55482970432 ns (18.53%), 5548 samples
    [ 0] jdk.internal.misc.Unsafe.getIntUnaligned
    [ 1] jdk.internal.misc.ScopedMemoryAccess.getIntUnalignedInternal
    [ 2] jdk.internal.misc.ScopedMemoryAccess.getIntUnaligned
    [ 3] java.lang.invoke.VarHandleSegmentAsInts.get
    [ 4] java.lang.invoke.VarHandleGuards.guard_LJ_I
    [ 5] jdk.internal.foreign.AbstractMemorySegmentImpl.get
    [ 6] gc_less.python_like.IntHashtableOffHeap.resizeIfNeeded
    [ 7] gc_less.python_like.IntHashtableOffHeap.put
    [ 8] gc_less.benchmarks.OffHeapBenchmark.testPutOffHeap

[1] https://github.com/openjdk/jmh

[2] https://github.com/gudzpoz/gc_less/commit/17dcc3eb57b89f2642...

gudzpoz··on JEP 467: Markdown Documentation Comments
Although it is not mentioned in the JEP, I wonder if we can use fenced code blocks as @snippet tags [1]. Of course one can still use {@snippet}, but fenced code blocks seem to me to be the go-to for code quoting in Markdown.

    ```java id=example
    class HelloWorld {
        public static void main(String... args) {
            System.out.println("Hello World!");  // @link substring="System.out" target="System#out"
        }
    }
    ```
(However, some JS highlighting libraries will strip pre-existing HTML in the code (e.g. PRISM.js [2], as is mentioned in the JEP), negating the @link tag above. Highlight.js [3] seems fine though.)

[1] https://openjdk.org/jeps/413 [2] https://prismjs.com/faq.html#if-pre-existing-html-is-strippe... [3] https://jsfiddle.net/LFJKR/

gudzpoz··on Java virtual threads hit with pinning issue
By the way, there was a recent HN discussion on a real-world example of deadlock caused by `synchronized` pinning ("We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres") [1].

[1] https://news.ycombinator.com/item?id=39008026

gudzpoz··on Ask HN: Show me your half baked project
https://gudzpoz.github.io/brocatel/tutorial.html

It's a (story-)scripting language based on Markdown and Lua. Basically it lets you write choice-based interactive fictions in Markdown (and Lua code blocks for advanced usages).

It is not actively developed these days since I consider the language itself is somehow usable and I have little free time these days. But the runtime-time API and compile-time macro API will probably need tons of improvements and I am still looking to implement a few features, like subroutine calls and threading support (not those threads though), and probably an IDE or at least a LSP implementation. (But again, I am quite occupied these days so the to-do list just piles up...)

Any feedback will be greatly appreciated!

← PreviousPage 2 of 2