Skip to content

Conversation

michaelkruglos
Copy link

I implemented functional and iterative version of SqlString.escapeId

Here are the benchmarks I got with npm run bench on my computer:

  escapeId

  12 tests completed.

  "col"                            x 1,881,330 ops/sec ±1.37% (189 runs sampled)
  "tbl.col"                        x 1,629,198 ops/sec ±1.38% (190 runs sampled)
  ["col1", "col2"]                 x   707,386 ops/sec ±1.54% (187 runs sampled)
  Array of 20 strings              x    86,097 ops/sec ±1.49% (190 runs sampled)
  "col" <Functional>               x 1,888,515 ops/sec ±1.88% (191 runs sampled)
  "tbl.col" <Functional>           x 1,645,613 ops/sec ±1.28% (191 runs sampled)
  ["col1", "col2"] <Functional>    x   714,820 ops/sec ±1.41% (189 runs sampled)
  Array of 20 strings <Functional> x    86,167 ops/sec ±1.40% (190 runs sampled)
  "col" <Iterative>                x 1,932,067 ops/sec ±1.26% (189 runs sampled)
  "tbl.col" <Iterative>            x 1,660,778 ops/sec ±1.51% (190 runs sampled)
  ["col1", "col2"] <Iterative>     x   632,021 ops/sec ±1.87% (188 runs sampled)
  Array of 20 strings <Iterative>  x    69,959 ops/sec ±1.39% (190 runs sampled)

Let me know if you want to merge iterative implementation, and I'll cleanup the code.

@dougwilson
Copy link
Member

Can you elaborate more? Based on the posted benchmarks, it would seem that the iterative implementation quickly gets worse for a small margin of being fast in the first two cases?

@michaelkruglos
Copy link
Author

I must have misread the numbers. Sorry.
This code and the benchmark results are very counterintuitive.

@michaelkruglos michaelkruglos deleted the patch-1 branch March 12, 2020 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants