Skip to content
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

Add --enable-trace-log install option #832

Merged
merged 1 commit into from
Jan 9, 2023
Merged

Conversation

Watson1978
Copy link
Collaborator

I think the trace log feature is for debugging and most people don't use it. Therefore, I usually want to improve performance by removing unnecessary instructions.

before after result
Oj.dump 1.440M 1.697M 1.178x

Environment

  • Linux
    • Manjaro Linux x86_64
    • Kernel: 6.1.1-1-MANJARO
    • AMD Ryzen 7 5800H
    • gcc version 12.2.0
    • Ruby 3.2.0

Before

Warming up --------------------------------------
             Oj.dump   142.510k i/100ms
Calculating -------------------------------------
             Oj.dump      1.440M (± 0.4%) i/s -     14.536M in  10.091795s

After

Warming up --------------------------------------
             Oj.dump   165.140k i/100ms
Calculating -------------------------------------
             Oj.dump      1.697M (± 0.7%) i/s -     17.009M in  10.025122s

Test code

require 'benchmark/ips'
require 'oj'

data = [[1,2,3,4,5]]*10

Benchmark.ips do |x|
  x.time = 10

  x.report('Oj.dump') do
    Oj.dump(data)
  end
end

I think the trace log feature is for debugging and most people don't use it.
Therefore, I usually want to improve performance by removing unnecessary instructions.

−       | before | after  | result
--       | --     | --     | --
Oj.dump  | 1.440M | 1.697M | 1.178x

### Environment
- Linux
  - Manjaro Linux x86_64
  - Kernel: 6.1.1-1-MANJARO
  - AMD Ryzen 7 5800H
  - gcc version 12.2.0
  - Ruby 3.2.0

### Before
```
Warming up --------------------------------------
             Oj.dump   142.510k i/100ms
Calculating -------------------------------------
             Oj.dump      1.440M (± 0.4%) i/s -     14.536M in  10.091795s
```

### After
```
Warming up --------------------------------------
             Oj.dump   165.140k i/100ms
Calculating -------------------------------------
             Oj.dump      1.697M (± 0.7%) i/s -     17.009M in  10.025122s
```

### Test code
```ruby
require 'benchmark/ips'
require 'oj'

data = [[1,2,3,4,5]]*10

Benchmark.ips do |x|
  x.time = 10

  x.report('Oj.dump') do
    Oj.dump(data)
  end
end
```
@Watson1978 Watson1978 marked this pull request as ready for review January 8, 2023 23:48
@ohler55
Copy link
Owner

ohler55 commented Jan 8, 2023

I agree, it is rarely used to having a compile options makes sense.

@ohler55 ohler55 merged commit 8a1773d into ohler55:develop Jan 9, 2023
@Watson1978 Watson1978 deleted the trace branch January 9, 2023 00:03
Watson1978 added a commit to Watson1978/oj that referenced this pull request Apr 16, 2023
I forgot to change these when I was add `-enable-trace-log` install option at ohler55#832.
ohler55 pushed a commit that referenced this pull request Apr 16, 2023
I forgot to change these when I was add `-enable-trace-log` install option at #832.
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