Skip to content

cow_utils really improve performance? #7

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

Open
heygsc opened this issue Jan 23, 2025 · 1 comment
Open

cow_utils really improve performance? #7

heygsc opened this issue Jan 23, 2025 · 1 comment

Comments

@heygsc
Copy link

heygsc commented Jan 23, 2025

cow_utils really improve performance?

I ran the official benchmark of cow_utils, I used m1 and m4 separately, tried many times, and the results were similar.

In the replace case, looks like the cow is pretty good, but in the to_lowercase, the cow is lagging behind in all three given situations.

Is my method incorrect? Or is it acceptable because the sample situation is special?

Replace in "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"/replace/("a", "")                                                                            
                        time:   [176.95 ns 177.30 ns 177.64 ns]
Found 6 outliers among 100 measurements (6.00%)
  1 (1.00%) low severe
  2 (2.00%) low mild
  2 (2.00%) high mild
  1 (1.00%) high severe
Replace in "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"/cow_replace/("a", "")                                                                            
                        time:   [129.38 ns 129.77 ns 130.12 ns]
Found 16 outliers among 100 measurements (16.00%)
  7 (7.00%) low severe
  3 (3.00%) low mild
  5 (5.00%) high mild
  1 (1.00%) high severe
Replace in "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"/replace/("b", "c")                                                                             
                        time:   [36.169 ns 36.484 ns 36.877 ns]
Found 9 outliers among 100 measurements (9.00%)
  4 (4.00%) high mild
  5 (5.00%) high severe
Replace in "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"/cow_replace/("b", "c")                                                                             
                        time:   [18.609 ns 18.769 ns 18.970 ns]
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) high mild
  1 (1.00%) high severe
Replace in "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"/replace/("a", "b")                                                                            
                        time:   [325.59 ns 328.93 ns 332.02 ns]
Replace in "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"/cow_replace/("a", "b")                                                                            
                        time:   [302.97 ns 306.83 ns 311.13 ns]
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) high mild
  1 (1.00%) high severe

To Lowercase/to_lowercase/Ax40                                                                             
                        time:   [19.452 ns 19.561 ns 19.669 ns]
Found 4 outliers among 100 measurements (4.00%)
  3 (3.00%) high mild
  1 (1.00%) high severe
To Lowercase/cow_to_lowercase/Ax40                                                                             
                        time:   [21.313 ns 21.444 ns 21.619 ns]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high severe
To Lowercase/to_lowercase/ax40                                                                             
                        time:   [19.870 ns 20.003 ns 20.167 ns]
                        change: [+1.6515% +2.4320% +3.2139%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 2 outliers among 100 measurements (2.00%)
  1 (1.00%) high mild
  1 (1.00%) high severe
To Lowercase/cow_to_lowercase/ax40                                                                            
                        time:   [95.169 ns 95.764 ns 96.785 ns]
                        change: [+342.20% +345.10% +348.79%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 9 outliers among 100 measurements (9.00%)
  4 (4.00%) high mild
  5 (5.00%) high severe
To Lowercase/to_lowercase/ax20 + Ax20                                                                             
                        time:   [19.704 ns 19.807 ns 19.914 ns]
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high mild
To Lowercase/cow_to_lowercase/ax20 + Ax20                                                                            
                        time:   [70.502 ns 70.723 ns 70.983 ns]
Found 8 outliers among 100 measurements (8.00%)
  3 (3.00%) high mild
  5 (5.00%) high severe
@RReverser
Copy link
Owner

Hm perhaps the stdlib changed implementation as it's been a while, or perhaps it's different on those CPUs... Hard to say without further digging.

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

No branches or pull requests

2 participants