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

feat: Add support for sub() and gsub() #420

Merged
merged 2 commits into from
Dec 26, 2024

Conversation

toppyy
Copy link
Contributor

@toppyy toppyy commented Dec 22, 2024

Adds translation for sub and gsub to regexp_replace. No related issue.

No support for parameters beyond pattern, replacement and x.

Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 9141e73 is merged into main:

  • 🚀001_tpch_01: 28.9ms -> 23.8ms [-21.04%, -13.91%]
  • ✔️001_tpch_02: 155ms -> 155ms [-0.9%, +1.31%]
  • ✔️001_tpch_03: 64.9ms -> 65.1ms [-1.29%, +1.82%]
  • ✔️001_tpch_04: 22.3ms -> 22.3ms [-1.51%, +1.67%]
  • ✔️001_tpch_05: 150ms -> 151ms [-1.1%, +1.54%]
  • ✔️001_tpch_06: 19.4ms -> 19.5ms [-1.62%, +2.35%]
  • ✔️001_tpch_07: 137ms -> 137ms [-0.6%, +2.02%]
  • ✔️001_tpch_08: 155ms -> 156ms [-0.75%, +1.24%]
  • ✔️001_tpch_09: 160ms -> 159ms [-1.52%, +0.7%]
  • ✔️001_tpch_10: 74.1ms -> 73.1ms [-3.17%, +0.39%]
  • ✔️001_tpch_11: 32.6ms -> 32.7ms [-0.96%, +1.55%]
  • ✔️001_tpch_12: 27.4ms -> 27.7ms [-1.07%, +3.52%]
  • ✔️001_tpch_13: 24.7ms -> 24.8ms [-1.87%, +2.68%]
  • ✔️001_tpch_14: 25.9ms -> 25.8ms [-2.35%, +1.44%]
  • ✔️001_tpch_15: 32.5ms -> 31.9ms [-4.48%, +0.47%]
  • ✔️001_tpch_16: 65.7ms -> 66.1ms [-1.17%, +2.27%]
  • ✔️001_tpch_17: 26.1ms -> 26.3ms [-0.01%, +2.18%]
  • 🚀001_tpch_18: 28.4ms -> 22.3ms [-25.25%, -18.02%]
  • 🚀001_tpch_19: 129ms -> 67.6ms [-48.62%, -46.84%]
  • ✔️001_tpch_20: 78.6ms -> 78.1ms [-2.49%, +1.3%]
  • ✔️001_tpch_21: 105ms -> 105ms [-0.74%, +1.84%]
  • 🚀001_tpch_22: 159ms -> 96.6ms [-40.41%, -38.18%]
  • ❗🐌010_tpch_01: 80.1ms -> 82.7ms [+0.77%, +5.71%]
  • ✔️010_tpch_02: 75ms -> 74.2ms [-4.04%, +1.76%]
  • ✔️010_tpch_03: 63.1ms -> 63.1ms [-1.61%, +1.48%]
  • ✔️010_tpch_04: 44.6ms -> 46.5ms [-1.09%, +9.83%]
  • ✔️010_tpch_05: 95.4ms -> 93.5ms [-4.92%, +0.78%]
  • ✔️010_tpch_06: 33.2ms -> 34.5ms [-4.61%, +12.62%]
  • ✔️010_tpch_07: 109ms -> 110ms [-1.74%, +2.8%]
  • ✔️010_tpch_08: 131ms -> 131ms [-1.35%, +2.73%]
  • ✔️010_tpch_09: 122ms -> 119ms [-5.8%, +1.07%]
  • ✔️010_tpch_10: 79.4ms -> 77.9ms [-5.4%, +1.65%]
  • ✔️010_tpch_11: 39.5ms -> 40.8ms [-0.86%, +7.33%]
  • ✔️010_tpch_12: 57.4ms -> 57.8ms [-0.36%, +1.61%]
  • ✔️010_tpch_13: 53.4ms -> 53.7ms [-0.98%, +2.26%]
  • ✔️010_tpch_14: 37.7ms -> 38.7ms [-2.31%, +7.49%]
  • ✔️010_tpch_15: 56.3ms -> 55.2ms [-7.18%, +2.97%]
  • ✔️010_tpch_16: 46.1ms -> 44.9ms [-5.39%, +0.02%]
  • ✔️010_tpch_17: 53.2ms -> 53.5ms [-0.8%, +1.92%]
  • ✔️010_tpch_18: 52.5ms -> 53.8ms [-4.86%, +9.88%]
  • ✔️010_tpch_19: 118ms -> 118ms [-1.97%, +1.58%]
  • ✔️010_tpch_20: 69.7ms -> 69.9ms [-2.56%, +3.3%]
  • ✔️010_tpch_21: 243ms -> 241ms [-3.69%, +1.72%]
  • ✔️010_tpch_22: 77.4ms -> 77.7ms [-1.69%, +2.54%]
  • ✔️100_tpch_01: 324ms -> 323ms [-19.98%, +19.29%]
  • ✔️100_tpch_02: 128ms -> 126ms [-5.22%, +2.68%]
  • ✔️100_tpch_03: 184ms -> 174ms [-14.9%, +3.59%]
  • ✔️100_tpch_04: 152ms -> 151ms [-7.26%, +4.98%]
  • ✔️100_tpch_05: 256ms -> 258ms [-3.56%, +5.15%]
  • ✔️100_tpch_06: 107ms -> 103ms [-21.6%, +13.94%]
  • ✔️100_tpch_07: 243ms -> 240ms [-4.13%, +1.98%]
  • ✔️100_tpch_08: 256ms -> 256ms [-10.77%, +10.3%]
  • ✔️100_tpch_09: 317ms -> 337ms [-3.68%, +16.65%]
  • ✔️100_tpch_10: 211ms -> 217ms [-5.16%, +10.85%]
  • ✔️100_tpch_11: 86ms -> 85.4ms [-9.28%, +7.7%]
  • ✔️100_tpch_12: 202ms -> 189ms [-15.53%, +2.35%]
  • ✔️100_tpch_13: 315ms -> 327ms [-7.53%, +15.04%]
  • 🚀100_tpch_14: 130ms -> 116ms [-19.87%, -2.84%]
  • ✔️100_tpch_15: 226ms -> 220ms [-7.56%, +2.6%]
  • ✔️100_tpch_16: 131ms -> 126ms [-15.41%, +6.78%]
  • ✔️100_tpch_17: 183ms -> 185ms [-11.05%, +14.25%]
  • ✔️100_tpch_18: 196ms -> 196ms [-12.27%, +11.74%]
  • ✔️100_tpch_19: 293ms -> 294ms [-12.9%, +13.27%]
  • ✔️100_tpch_20: 179ms -> 180ms [-9.26%, +11.11%]
  • ✔️100_tpch_21: 1.29s -> 1.32s [-1.34%, +6.18%]
  • ✔️100_tpch_22: 169ms -> 169ms [-3.29%, +3.07%]

Further explanation regarding interpretation and methodology can be found in the documentation.

@krlmlr krlmlr changed the title feat: Add support for sub and gsub feat: Add support for sub() and gsub() Dec 25, 2024
@krlmlr
Copy link
Member

krlmlr commented Dec 25, 2024

Thanks, looks good! Would you like to include these functions in the list of supported translations in the vignette?

@toppyy
Copy link
Contributor Author

toppyy commented Dec 26, 2024

oh, missed that part, thanks! They are now listed in the vignette.

Copy link
Contributor

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 93a626f is merged into main:

  • 🚀001_tpch_01: 29.5ms -> 23.2ms [-24.67%, -18.52%]
  • ✔️001_tpch_02: 154ms -> 154ms [-0.93%, +0.79%]
  • ✔️001_tpch_03: 64.5ms -> 64.9ms [-0.49%, +1.71%]
  • ✔️001_tpch_04: 22.1ms -> 22.2ms [-0.68%, +0.79%]
  • ✔️001_tpch_05: 148ms -> 148ms [-1.06%, +0.79%]
  • ✔️001_tpch_06: 19.3ms -> 19.2ms [-2.03%, +1.4%]
  • ✔️001_tpch_07: 135ms -> 136ms [-0.57%, +1.39%]
  • ✔️001_tpch_08: 155ms -> 154ms [-1.6%, +0.13%]
  • ✔️001_tpch_09: 159ms -> 160ms [-0.43%, +1.67%]
  • ✔️001_tpch_10: 72.1ms -> 72.3ms [-1.47%, +2.05%]
  • ✔️001_tpch_11: 32.6ms -> 32.8ms [-0.47%, +1.68%]
  • ✔️001_tpch_12: 26.7ms -> 26.6ms [-1.15%, +0.84%]
  • ✔️001_tpch_13: 24ms -> 24.6ms [-1.49%, +6.64%]
  • 🚀001_tpch_14: 25ms -> 24.7ms [-2.17%, -0.18%]
  • ✔️001_tpch_15: 31.1ms -> 31.2ms [-0.89%, +1.18%]
  • ✔️001_tpch_16: 62.5ms -> 62.3ms [-1.29%, +0.92%]
  • ✔️001_tpch_17: 25.6ms -> 25.6ms [-0.67%, +0.82%]
  • 🚀001_tpch_18: 27ms -> 21.6ms [-21.67%, -18.66%]
  • 🚀001_tpch_19: 124ms -> 65.9ms [-47.86%, -45.89%]
  • ✔️001_tpch_20: 73.4ms -> 74.1ms [-0.82%, +2.78%]
  • ✔️001_tpch_21: 101ms -> 101ms [-0.58%, +1.96%]
  • 🚀001_tpch_22: 148ms -> 89ms [-40.9%, -39.02%]
  • ✔️010_tpch_01: 81.1ms -> 79.9ms [-6.16%, +3.17%]
  • ✔️010_tpch_02: 70.3ms -> 69.7ms [-2.34%, +0.71%]
  • ✔️010_tpch_03: 59.5ms -> 59.9ms [-0.43%, +1.73%]
  • ✔️010_tpch_04: 42.2ms -> 42.6ms [-1.58%, +3.53%]
  • ✔️010_tpch_05: 92.6ms -> 90.4ms [-6.02%, +1.29%]
  • ✔️010_tpch_06: 34.6ms -> 32.3ms [-15.96%, +2.67%]
  • ✔️010_tpch_07: 106ms -> 107ms [-0.44%, +1.93%]
  • ✔️010_tpch_08: 130ms -> 128ms [-4.67%, +1.04%]
  • ❗🐌010_tpch_09: 115ms -> 117ms [+0.29%, +4.05%]
  • ✔️010_tpch_10: 76.5ms -> 76.3ms [-1.29%, +0.89%]
  • ✔️010_tpch_11: 37.6ms -> 38ms [-1.84%, +4.07%]
  • ✔️010_tpch_12: 57.6ms -> 58ms [-3.64%, +5.03%]
  • ✔️010_tpch_13: 52.2ms -> 52ms [-1.64%, +0.73%]
  • ✔️010_tpch_14: 37.5ms -> 37.3ms [-2.65%, +1.33%]
  • ✔️010_tpch_15: 55.1ms -> 57.2ms [-2.59%, +10.24%]
  • ✔️010_tpch_16: 45.5ms -> 45.5ms [-2.85%, +2.98%]
  • ✔️010_tpch_17: 56.3ms -> 53.4ms [-10.82%, +0.64%]
  • ✔️010_tpch_18: 53.7ms -> 51.9ms [-11.26%, +4.48%]
  • ✔️010_tpch_19: 116ms -> 116ms [-0.63%, +1.2%]
  • ✔️010_tpch_20: 67.6ms -> 69.8ms [-1.35%, +7.94%]
  • ✔️010_tpch_21: 243ms -> 240ms [-4.7%, +1.74%]
  • ✔️010_tpch_22: 77.8ms -> 76.9ms [-2.29%, +0.15%]
  • ✔️100_tpch_01: 312ms -> 328ms [-12.48%, +22.52%]
  • ✔️100_tpch_02: 123ms -> 124ms [-3.35%, +5.01%]
  • ✔️100_tpch_03: 179ms -> 180ms [-2.51%, +3.62%]
  • ✔️100_tpch_04: 155ms -> 149ms [-9.64%, +2.64%]
  • ✔️100_tpch_05: 255ms -> 263ms [-6.69%, +13.14%]
  • ✔️100_tpch_06: 101ms -> 104ms [-5.58%, +12.15%]
  • ✔️100_tpch_07: 245ms -> 233ms [-10.33%, +0.66%]
  • ✔️100_tpch_08: 258ms -> 266ms [-8.48%, +14.41%]
  • ❗🐌100_tpch_09: 311ms -> 353ms [+3.74%, +23.49%]
  • ✔️100_tpch_10: 212ms -> 211ms [-8.94%, +7.81%]
  • ✔️100_tpch_11: 84.9ms -> 83.7ms [-8.72%, +5.87%]
  • ❗🐌100_tpch_12: 190ms -> 203ms [+0.25%, +13.89%]
  • ✔️100_tpch_13: 303ms -> 314ms [-3.56%, +11.16%]
  • ✔️100_tpch_14: 125ms -> 128ms [-12.19%, +17.86%]
  • ✔️100_tpch_15: 221ms -> 221ms [-2.47%, +2.06%]
  • ✔️100_tpch_16: 128ms -> 126ms [-7.56%, +5.91%]
  • ✔️100_tpch_17: 174ms -> 174ms [-9.03%, +9.05%]
  • ✔️100_tpch_18: 210ms -> 191ms [-19.79%, +1.25%]
  • ✔️100_tpch_19: 288ms -> 298ms [-14.83%, +21.83%]
  • ✔️100_tpch_20: 186ms -> 173ms [-17.81%, +4.64%]
  • ✔️100_tpch_21: 1.33s -> 1.31s [-5.38%, +1.57%]
  • ✔️100_tpch_22: 173ms -> 172ms [-4.05%, +2.28%]

Further explanation regarding interpretation and methodology can be found in the documentation.

@krlmlr krlmlr merged commit 33ed92b into tidyverse:main Dec 26, 2024
18 checks passed
@krlmlr
Copy link
Member

krlmlr commented Dec 26, 2024

Thanks! Let's ignore the differences between TRE, PCRE, and RE2 for a moment 🙈

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