ohler55 / oj

Optimized JSON
http://www.ohler.com/oj
MIT License
3.16k stars 252 forks source link

OJ for Crystal #512

Closed proyb6 closed 5 years ago

proyb6 commented 6 years ago

Crystal programming language https://crystal-lang.org/

Another request for C binding in Crystal. Could be refactor Ruby code for Crystal is even awesome.

I assume one of the tool could be used to auto generate C header for Crystal. https://github.com/j8r/crystal-autobind/blob/master/README.md

ohler55 commented 6 years ago

This is really not appropriate since Oj is a Ruby gem. While Crystal has a similar syntax to Ruby it is not the same. I did look at Crystal in the hopes that I could write a JSON parser as a way to try out Crystal's C bindings but I was not able to find much documentation on how to do that in a reasonable way.

In any case, even if there were to be a Oj for Crystal it would be a complete rewrite and a separate repository. Glad you felt Oj was worth porting to Crystal though. I am keeping an eye on Crystal so maybe in the future some time.

proyb6 commented 6 years ago

I get it, there is a need to refactor and replace Ruby header, and I assume you read this?

https://crystal-lang.org/docs/syntax_and_semantics/c_bindings/

ohler55 commented 6 years ago

Yes, read that. Oj parses into Ruby values. Would have to change to Crystal but there does not seem to be an API for that.

proyb6 commented 6 years ago

Yup, no API for that. I think there might be an interest for agnostic libraries.

ohler55 commented 6 years ago

Crystal is still pretty young. Maybe as it grows. If the primary developers are interested I might be interested in being the JSON, XML, and web server guy.

proyb6 commented 6 years ago

In my opinion, I do feel the web server could be improve and I used H2O for my sites, until I'm surprise H2O.cr outperforms H2O in C according to the TechEmpower Benchmark. Perhaps, they are useful for your research and reset.cr

https://github.com/S-YOU/h2o.cr https://github.com/S-YOU/reset.cr

ohler55 commented 6 years ago

I wonder how H2O compares to my Agoo server.

proyb6 commented 6 years ago

Just to clarify, I use the H2O with MRuby as a proxy server, not the libh2o which allows me to leverage with HTTP/2 Push which is no different in performance for a 1 core VPS. I think the advantage that Kazuho and his team are working on new features including QUIC.

I would prefer compiled code and typed language for security reasons when compare to Ruby when we going to deal with different kinds for data structure.

ohler55 commented 6 years ago

There are some advantages to having a compiled app. That and performance.

proyb6 commented 6 years ago

What about getting Agoo in the benchmark?

https://github.com/the-benchmarker/web-frameworks

ohler55 commented 6 years ago

Interesting. I’ll have to submit Agoo results. Thanks.

ohler55 commented 5 years ago

Looked into it but Crystal is a different language all together. While it might be interesting to write a new package for Crystal it would not be part of Oj for Ruby.