ruby / json

JSON implementation for Ruby
https://ruby.github.io/json
Other
704 stars 333 forks source link

Speedup #generate_json by using case/when/end #674

Closed eregon closed 2 weeks ago

eregon commented 3 weeks ago
byroot commented 3 weeks ago
  • The only case where an exact class check is needed so far is for String

That's the one case where we had a failing test for it, but does that mean we should special case it?

I'm open to say only String subclasses have that behavior, but then all 3 implementations should match behavior. Could you add some tests to make sure we converge them?

Also I'm very surprised .class is this expensive on Truffle, I wouldn't have expected it.

eregon commented 2 weeks ago

I'll rebase and see if the added tests fail on this PR or if they are fine.

eregon commented 2 weeks ago

Tests seem to pass after rebase from a local test run.