Skip to content

Fix performance on Ruby 3.0 - #24

Closed
Watson1978 wants to merge 1 commit into
saka1:masterfrom
Watson1978:fix-performance
Closed

Fix performance on Ruby 3.0#24
Watson1978 wants to merge 1 commit into
saka1:masterfrom
Watson1978:fix-performance

Conversation

@Watson1978

Copy link
Copy Markdown
Contributor

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 issue same with anilmaurya/fast_jsonparser#20

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)
```
saka1 pushed a commit that referenced this pull request Apr 10, 2026
Based on the fix by Watson1978 in PR #24. Ruby 3.0+ no longer
includes $(optflags) in CXXFLAGS automatically, causing simdjson
to compile without -O2.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@saka1

saka1 commented Apr 10, 2026

Copy link
Copy Markdown
Owner

Thanks. The fix has been included in #26 (with you as the commit author). Closing.

@saka1 saka1 closed this Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants