Phrogz / NeatJSON

Pretty-print your JSON in Ruby, JS, or Lua with more power than JSON.stringify or JSON.pretty_generate
http://phrogz.net/JS/NeatJSON
MIT License
108 stars 19 forks source link

Feature/opal support #15

Closed bwl21 closed 8 years ago

bwl21 commented 8 years ago

I took your latest master branch and made the tests with Opal. There is still the issue that opal does not support mutable strings (it is a transpiler to javascript which lacks this support).

I changed the immutable string issues and now all tests pass if run through opal. There was also a difference when handling arbitrary classes. to_json behaves slightly different between ruby and opal with respect of options and indentation.

I never used mutable strings in ruby so all my ruby code worked well with Opal.

This PR replaces PR #13. I would really appreciate if you could consicer merge this.

bwl21 commented 8 years ago

Could you please make a decision if you intend merge this pull request. Due to the recent changes it now has new merge conflicts.

If you do not intend to merge, it is ok for me, but then I need to continue with my own fork.

Phrogz commented 8 years ago

I finally got around to perf testing. I appreciate your pull request, for it allowed me to easily identify which areas needed to be fixed. However, I wanted some of the code to be a little different, so I decided to make my own modifications to make it work for Opal.

Commit b72faf3128 fixes the string mutation issue and supports Opal. I've released this as v0.8.1.

bwl21 commented 8 years ago

It is fine wit me. Thanks for adding the Opal support. I will give it a try in my app.

Phrogz commented 8 years ago

BTW, the impact of moving to non-mutating was negligible; about a 0.7% increase in performance time on large (50k) JSON formatting, over a variety of options.