Live data from Hacker News

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

github.com

41–50 of 196 posts

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

#41

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-…

One of the main ideas of query-json is to provide excelent errors. So, it would teach you by using the tool.

and there are a few techniques to "discover" the schema of the json file, I trend to read with '.' or 'keys' and later keep going.

I'm planning to implement a flag where each operation prints the internal state of the json, so you would see what are the "pipes".

I will pick a few of your cheatsheet to implement next in q, Thanks!

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

#42

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-…

For my part, I've always wanted a tool that just replicates PostgreSQL's JSON syntax. That way I can have only one syntax to remember.

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

#43
post #8

Are we sure it should get a single-letter 'q' binary name though? Docs seem to point that it's short for 'query-json'? Why not call it 'query-json' and let the user decide that as a shell alias or whatever. Even the ubiquitous 'ls' and 'cd' are two characters.

And there's also this 'q':

http://harelba.github.io/q/

Query CSV with SQL

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

#44
post #40
post #9

Hm, I thought q is synonym for querying CSV files https://harelba.github.io/q/

Same. When I saw the name "q" I thought of this same tool.

Right, I found q cute... but I'm thinking to release new version with the name query-json or just change the name all-together. Any suggestion? ^^

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

#45

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 ^_^

Gqd, look how that looks like 666, edit distance is 3. Turn around the letters. Here have a timeline: https://imgur.com/a/aQYnKLm

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

#46

Do we need to make jq faster ? Anyone has issues with current speed ? Is there any specific reason other than "because we can" ?

I'm not sure at which "we" do you refer.

Reimplementing a piece of software that is 12 years old which mimics their UX and improves performance and error messages it's more than welcome in my opinion. My purpose was to learn the OCaml stack of writting compilers, so I personally found that I "needed" a language already created.

Thanks for raising those concerns

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

#48

Earlier quoted context omitted.

jq is pretty fast in my experience. But there have been cases where I've wanted it to be faster (dealing with a 90GB JSON file). The main weakness seems to be streaming use cases (not having the whole file in memory at once). These are supported, but the syntax is quite awkward.

Out of interest, what created a 90GB JSON file?

I don't think it's quite 90GB, but I've processed Wikidata dumps in the same order of magnitude before (which are one JSON object per line) with jq, and it could've certainly been faster.

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

#49
post #16

Earlier quoted context omitted.

or at least qj

I don't want to fight for name, q was a shortener. Happy to rename it to qj instead, but the option of renaming the binary it's a good workaround.

Given these are two of the least-used characters in English and basically never appear in this sequence, it would certainly help for all the reasons people are mentioning. It'd at least follow suit with like 'rg' for 'ripgrep'.

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

#50
post #26

As an outsider I get very confused by the Reason / Reason Native / OCaml / Bucklescript / Rescript?! ecosystem. What does it mean for it to be written in Reason Native/OCaml?

Right, the explanation of Reason - BuckleScript - OCaml is always nebulous.

I used Reason to compile to Native, so using OCaml's stdlib and OCaml's dependencies and compiling it with OCaml, but my source code is written in Reason syntax.

Post reply on HN