Fork me on GitHub
#clojure
<
2023-04-30
>
slipset18:04:25

Being somewhat inspired by @chris441’s conj talk, I’m trying to speed things up. However, I’m stumbling upon a conundrum. Using the output from https://github.com/clojure-goes-fast/clj-java-decompiler to observe my findings, it seems to me that I’m not able to typehint an argument to deftype as a char-array:

(deftype Foo [^{:tag char} bar])
gives
public final class Foo implements IType
{
    public final char bar;
    
    public Foo(final char bar) {
        this.bar = bar;
    }
...
}
whereas
(deftype Foo [^{:tag chars} bar])
gives
public final class Foo implements IType
{
    public final Object bar;
    
    public Foo(final Object bar) {
        this.bar = bar;
    }
}    
What am I missing?

hiredman18:04:30

Reference types are stored as type Object

slipset19:04:18

But not so much, some well placed type hints seem to go a long way

borkdude20:04:38

@U04V5VAUN I too was inspired by @chris441 talk. What are you trying to speed up?

emccue13:05:57

@U04V5VAUN if you do speed up data.json, let me know. I straight up copied it for my java library so optimizations are likely tranferrable

respatialized15:05:36

https://github.com/cnuernber/charred I assume that you may have already seen this library (also by @chris441) but in case anyone is interested in prior art / a drop-in high-performance replacement for data.json , this one has no external dependencies, so it's easier to understand in a self-contained way.

slipset16:05:01

I’m basically taking all/some of the good ideas from charred and sticking them into data.json

1
lread17:05:30

Interesting! And looking forward to learning from what you come up with!