-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Very slow on Ruby 3 #20
Comments
@yahorbukhta Thanks for pointing out, will check it on Ruby 3 |
yes, after test, fast_jsonparser became slow in ruby 3. in ruby 3.0.1
in ruby 2.7.1
|
The Makefile generated by extconf.rb has changed in Ruby 3.0. Therefore, when using Ruby 3.0, the optimization flags are not set properly and it reduced the performance. This patch will set optimization flags in compiling properly. Here is Ruby 2.7 Makefile result ``` CXXFLAGS = $(CCDLFLAGS) -g -O2 -std=c++1z -Wno-register $(ARCH_FLAG) ``` Here is Ruby 3.0 Makefile ``` CXXFLAGS = $(CCDLFLAGS) -std=c++1z -Wno-register $(ARCH_FLAG) ``` This PR will fix anilmaurya#20 issue.
The Makefile generated by extconf.rb has changed in Ruby 3.0. Therefore, when using Ruby 3.0, the optimization flags are not set properly and it reduced the performance. This patch will set optimization flags in compiling properly. - Here is Ruby 2.7 Makefile result: ``` CXXFLAGS = $(CCDLFLAGS) -g -O2 -std=c++1z -Wno-register $(ARCH_FLAG) ``` - Here is Ruby 3.0 Makefile result: ``` CXXFLAGS = $(CCDLFLAGS) -std=c++1z -Wno-register $(ARCH_FLAG) ``` This PR will fix anilmaurya#20 issue.
FYI this is still the case - I'm also on M1. Is there a fix coming? $ ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21] require 'fast_jsonparser'
require 'json'
require 'benchmark'
require_relative './lib/helpers'
json_files = get_auction_files(true)
puts "File count: #{json_files.size}"
Benchmark.bm(100) do |x|
x.report("(warm up)") do
json_files.each {|f| File.read(f) }
end
x.report("FastJsonparser.load(f)") do
json_files.each {|f| FastJsonparser.load(f) }
end
x.report("JSON.parse(File.read(f))") do
json_files.each {|f| JSON.parse(File.read(f)) }
end
end File count: 65317
user system total real
(warm up) 0.203463 0.813508 1.016971 ( 1.017386)
FastJsonparser.load(f) 4.499778 0.858779 5.358557 ( 5.359655)
JSON.parse(File.read(f)) 0.648639 0.783460 1.432099 ( 1.432469) |
Hi @ukd1 |
@anilmaurya I don't have the time I'm afraid! They say it does in the PR saka1/simdjson_ruby#24. Are you planning on fixing this? |
Yes, will fix it in couple of days. |
I am switching a project I'm on to use this libray, and I can't create the PR for it until this is fixed (or I'll have to commit again with a fixed library). Any ETA on when we can get it merged? I hate to be a nag, but I'm blocked and you've already done the awesome work :) |
@fearoffish Thanks for reminder. Releasing new version in sometime. |
Released version |
BTW, retried this today, and it's still slow. I switched back to oj. $ ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23] |
This solutions became slow in Ruby 3
The text was updated successfully, but these errors were encountered: