3 ms·
I wonder if a C/C++ programm would perform better?
by CyberMew 8y ago
I wonder if a C/C++ programm would perform better?
- JulianMorrison 8y agojq is a C program. In theory a truly specific program could work better. In practise, the broad scope of jq allows you to discover the operations you need and respond to changes in requirements without being locked into custom code, and any given programmer probably couldn't do the same job better.
- cryptonector 8y agojq is a C program, yes, but jq programs are interpreted. Because jq is a dynamically-typed language, it wouldn't be easy to compile it to object code that would run too much faster than the byte-interpreted version (though it would still run faster). As you say, jq's power is that it is an expressive language, and it's much much easier to write jq programs that work than it is to write C/C++ programs as needed that do the same or similar work.
- JulianMorrison 8y agoThe interpreted language is just the setup phase for a pipeline of compiled-in data transformations.
- cryptonector 8y agoI don't understand this statement. Keep in mind I'm a jq maintainer.
- cryptonector 8y agoYes. If well-written anyways.