Live data from Hacker News

Q: A faster re-implementaiton of jq written in Reason Native/OCaml

github.com

61–70 of 196 posts

Re: Q: A faster re-implementaiton of jq written in Reason Native/OCaml

#61
Slightly out of context here, I find the entire stack of bsb, bsb-native, ocaml and esy pretty cool. However, I just dont find enough resources, good tutorials etc on Google search. Is there a good set of beginner tutorials anyone can point to ? Thanks in advance.

Re: Q: A faster re-implementaiton of jq written in Reason Native/OCaml

#62
post #54

Earlier quoted context omitted.

Yes, I don't understand how people end up with assertions that the filename is a require argument. At least we've got /dev/stdin or /proc/self/fd/0 as workarounds.

files might be faster, because you can mmap them?

Most people work on compressed JSON lines files. Sometimes they are stored on s3. Files do not give flexibility.

When using jq, I can do a lot of things:

    aws s3 cp s3://bucket/file.json.gz - | zcat | head | jq .field | sort

Re: Q: A faster re-implementaiton of jq written in Reason Native/OCaml

#63

Earlier quoted context omitted.

Yeah. Can you imagine trying to do a web search for ‘q’?

I can and it is lightly disturbing. https://imgur.com/a/yAOF31g ^_^

I was hoping for some star trek shenanigans... I am disappointed.

Re: Q: A faster re-implementaiton of jq written in Reason Native/OCaml

#64
post #59

The speed is not concern for me. I am wondering if there something better than `jq` in terms of syntax. Whenever I want to get something more that just prettify json output in the console or simply get value by specific field name I have a problem, for me it is just difficult to remember jq syntax without looking into history. As well have in my notes links to examples like this one https://mosermichael.github.io/jq-…

Check out jql [ https://github.com/cube2222/jql ] and oj [ https://github.com/ohler55/ojg ]

definitively will take a look, I've never heard of `jql` before, thanks

Re: Q: A faster re-implementaiton of jq written in Reason Native/OCaml

#66
post #62

Earlier quoted context omitted.

files might be faster, because you can mmap them?

Most people work on compressed JSON lines files. Sometimes they are stored on s3. Files do not give flexibility. When using jq, I can do a lot of things: aws s3 cp s3://bucket/file.json.gz - | zcat | head | jq .field | sort

Another common thing you can do is accept a generic stream as input, but have some code that penetrates the abstraction a bit to see what kind of stream it is, and if it is a file or something, do something special with it to go even faster. This way, you start with something maximally useful up front, and easy to use, but you can optimize things based on details as you go.

That's how Go's static file web server works. It serves streams, but if you happen to io.Copy to that stream with something that is also an ∗os.File on Linux, it can use the sendfile call in the kernel instead. (A downside of making it so transparent is that if you wrap that stream with something you may not realize that you've wrecked the optimization because it no longer unwraps to an ∗os.File but whatever your wrapper is, but, well, nothing's perfect.)

Re: Q: A faster re-implementaiton of jq written in Reason Native/OCaml

#67
post #62

Earlier quoted context omitted.

files might be faster, because you can mmap them?

Most people work on compressed JSON lines files. Sometimes they are stored on s3. Files do not give flexibility. When using jq, I can do a lot of things: aws s3 cp s3://bucket/file.json.gz - | zcat | head | jq .field | sort

Which is sorta-kinda the same thing as

  jq .field 
which is more annoying to type but works.

Re: Q: A faster re-implementaiton of jq written in Reason Native/OCaml

#68
post #61

Slightly out of context here, I find the entire stack of bsb, bsb-native, ocaml and esy pretty cool. However, I just dont find enough resources, good tutorials etc on Google search. Is there a good set of beginner tutorials anyone can point to ? Thanks in advance.

The documentation is a problem in the OCaml world and a problem with Reason Native as well. I found myself pretty lost some times, esy.sh should be a initial point in contact for most of Reason related stuff.

Menhir/sedlex and others are pretty high accessibility barrier for new commers.

One of the nice things about all of it it's the discord, it's friendly and always helpful.

Hope it helps, just let me know if there's any specific!

Re: Q: A faster re-implementaiton of jq written in Reason Native/OCaml

#69
post #2

This looks nice, but I was a bit dismayed at "friends don't let friends curl | bash, to install this run curl | bash".

There's 4 alternatives to install query-json.

Before doing any curl | bash, check what's on the install command, that's the entire point of it.

Post reply on HN