-
Notifications
You must be signed in to change notification settings - Fork 28
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
Rewrite rules for toString
/toText
#212
Labels
type:feature
Something new is added.
Milestone
Comments
Martoon-00
added a commit
that referenced
this issue
May 30, 2019
Closes #212. I had to add `stringToText` and `textToString` functions in order to specify inlining pragma as mentioned [here](https://gitlab.haskell.org/ghc/ghc/issues/12632). Benchmarks without rewrite rule: ``` benchmarked toText/toString time 1.013 ms (875.1 μs .. 1.148 ms) 0.819 R² (0.691 R² .. 0.904 R²) mean 1.621 ms (1.268 ms .. 2.619 ms) std dev 2.134 ms (331.2 μs .. 4.071 ms) variance introduced by outliers: 97% (severely inflated) ``` And with rewrite rule: ``` benchmarked toText/toString time 186.1 μs (183.3 μs .. 188.4 μs) 0.998 R² (0.996 R² .. 0.999 R²) mean 189.4 μs (187.7 μs .. 191.8 μs) std dev 7.508 μs (5.823 μs .. 10.36 μs) variance introduced by outliers: 20% (moderately inflated) ```
9 tasks
Martoon-00
added a commit
that referenced
this issue
May 30, 2019
Closes #212. I had to add `stringToText` and `textToString` functions in order to specify inlining pragma as mentioned [here](https://gitlab.haskell.org/ghc/ghc/issues/12632). Benchmarks without rewrite rule: ``` benchmarked toText/toString time 1.013 ms (875.1 μs .. 1.148 ms) 0.819 R² (0.691 R² .. 0.904 R²) mean 1.621 ms (1.268 ms .. 2.619 ms) std dev 2.134 ms (331.2 μs .. 4.071 ms) variance introduced by outliers: 97% (severely inflated) ``` And with rewrite rule: ``` benchmarked toText/toString time 186.1 μs (183.3 μs .. 188.4 μs) 0.998 R² (0.996 R² .. 0.999 R²) mean 189.4 μs (187.7 μs .. 191.8 μs) std dev 7.508 μs (5.823 μs .. 10.36 μs) variance introduced by outliers: 20% (moderately inflated) ```
Martoon-00
added a commit
that referenced
this issue
May 30, 2019
Closes #212. I had to add `stringToText` and `textToString` functions in order to specify inlining pragma as mentioned [here](https://gitlab.haskell.org/ghc/ghc/issues/12632). Benchmarks without rewrite rule: ``` benchmarked toText/toString time 1.013 ms (875.1 μs .. 1.148 ms) 0.819 R² (0.691 R² .. 0.904 R²) mean 1.621 ms (1.268 ms .. 2.619 ms) std dev 2.134 ms (331.2 μs .. 4.071 ms) variance introduced by outliers: 97% (severely inflated) ``` And with rewrite rule: ``` benchmarked toText/toString time 186.1 μs (183.3 μs .. 188.4 μs) 0.998 R² (0.996 R² .. 0.999 R²) mean 189.4 μs (187.7 μs .. 191.8 μs) std dev 7.508 μs (5.823 μs .. 10.36 μs) variance introduced by outliers: 20% (moderately inflated) ```
Martoon-00
added a commit
that referenced
this issue
May 30, 2019
Closes #212. I had to add `stringToText` and `textToString` functions in order to specify inlining pragma as mentioned [here](https://gitlab.haskell.org/ghc/ghc/issues/12632). Benchmarks without rewrite rule: ``` benchmarked toText/toString time 1.013 ms (875.1 μs .. 1.148 ms) 0.819 R² (0.691 R² .. 0.904 R²) mean 1.621 ms (1.268 ms .. 2.619 ms) std dev 2.134 ms (331.2 μs .. 4.071 ms) variance introduced by outliers: 97% (severely inflated) ``` And with rewrite rule: ``` benchmarked toText/toString time 185.6 μs (182.7 μs .. 188.2 μs) 0.998 R² (0.996 R² .. 0.999 R²) mean 187.0 μs (185.2 μs .. 189.4 μs) std dev 7.211 μs (5.623 μs .. 10.07 μs) variance introduced by outliers: 20% (moderately inflated) ```
Martoon-00
added a commit
that referenced
this issue
May 30, 2019
Closes #212. I had to add `stringToText` and `textToString` functions in order to specify inlining pragma as mentioned [here](https://gitlab.haskell.org/ghc/ghc/issues/12632). Benchmarks without rewrite rule: ``` benchmarked toText/toString time 1.013 ms (875.1 μs .. 1.148 ms) 0.819 R² (0.691 R² .. 0.904 R²) mean 1.621 ms (1.268 ms .. 2.619 ms) std dev 2.134 ms (331.2 μs .. 4.071 ms) variance introduced by outliers: 97% (severely inflated) ``` And with rewrite rule: ``` benchmarked toText/toString time 185.6 μs (182.7 μs .. 188.2 μs) 0.998 R² (0.996 R² .. 0.999 R²) mean 187.0 μs (185.2 μs .. 189.4 μs) std dev 7.211 μs (5.623 μs .. 10.07 μs) variance introduced by outliers: 20% (moderately inflated) ```
Martoon-00
added a commit
that referenced
this issue
Jun 3, 2019
Added rewrite rule to eliminate toString . toText conversions. Closes #212. Benchmarks without rewrite rule: ``` benchmarked toText/toString time 1.013 ms (875.1 μs .. 1.148 ms) 0.819 R² (0.691 R² .. 0.904 R²) mean 1.621 ms (1.268 ms .. 2.619 ms) std dev 2.134 ms (331.2 μs .. 4.071 ms) variance introduced by outliers: 97% (severely inflated) ``` And with rewrite rule: ``` benchmarked toText/toString time 185.6 μs (182.7 μs .. 188.2 μs) 0.998 R² (0.996 R² .. 0.999 R²) mean 187.0 μs (185.2 μs .. 189.4 μs) std dev 7.211 μs (5.623 μs .. 10.07 μs) variance introduced by outliers: 20% (moderately inflated) ```
Martoon-00
added a commit
that referenced
this issue
Jul 18, 2019
Added rewrite rule to eliminate toString . toText conversions. Closes #212. Benchmarks without rewrite rule: ``` benchmarked toText/toString time 1.013 ms (875.1 μs .. 1.148 ms) 0.819 R² (0.691 R² .. 0.904 R²) mean 1.621 ms (1.268 ms .. 2.619 ms) std dev 2.134 ms (331.2 μs .. 4.071 ms) variance introduced by outliers: 97% (severely inflated) ``` And with rewrite rule: ``` benchmarked toText/toString time 185.6 μs (182.7 μs .. 188.2 μs) 0.998 R² (0.996 R² .. 0.999 R²) mean 187.0 μs (185.2 μs .. 189.4 μs) std dev 7.211 μs (5.623 μs .. 10.07 μs) variance introduced by outliers: 20% (moderately inflated) ```
Martoon-00
added a commit
that referenced
this issue
Jul 26, 2019
Added rewrite rule to eliminate toString . toText conversions. Closes #212. Benchmarks without rewrite rule: ``` benchmarked toText/toString time 1.013 ms (875.1 μs .. 1.148 ms) 0.819 R² (0.691 R² .. 0.904 R²) mean 1.621 ms (1.268 ms .. 2.619 ms) std dev 2.134 ms (331.2 μs .. 4.071 ms) variance introduced by outliers: 97% (severely inflated) ``` And with rewrite rule: ``` benchmarked toText/toString time 185.6 μs (182.7 μs .. 188.2 μs) 0.998 R² (0.996 R² .. 0.999 R²) mean 187.0 μs (185.2 μs .. 189.4 μs) std dev 7.211 μs (5.623 μs .. 10.07 μs) variance introduced by outliers: 20% (moderately inflated) ```
Martoon-00
added a commit
that referenced
this issue
Jul 26, 2019
Added rewrite rule to eliminate toString . toText conversions. Closes #212. Benchmarks without rewrite rule: ``` benchmarked toText/toString time 1.013 ms (875.1 μs .. 1.148 ms) 0.819 R² (0.691 R² .. 0.904 R²) mean 1.621 ms (1.268 ms .. 2.619 ms) std dev 2.134 ms (331.2 μs .. 4.071 ms) variance introduced by outliers: 97% (severely inflated) ``` And with rewrite rule: ``` benchmarked toText/toString time 185.6 μs (182.7 μs .. 188.2 μs) 0.998 R² (0.996 R² .. 0.999 R²) mean 187.0 μs (185.2 μs .. 189.4 μs) std dev 7.211 μs (5.623 μs .. 10.07 μs) variance introduced by outliers: 20% (moderately inflated) ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem: we consider using
Text
everywhere a good practice, but many libraries useString
instead, and some function may performtoString
just to scan/modify text contents. This may cause unnecessarytoText
followed bytoString
conversions.Solution: add rewrite rules for this case.
Probably
toString . (fromString :: String -> Text)
case would be also interesting.The text was updated successfully, but these errors were encountered: