Skip to content

use String::Builder for building query strings instead of Array.join#186

Merged
repomaa merged 1 commit into
Crecto:masterfrom
repomaa:string_builder
Aug 27, 2018
Merged

use String::Builder for building query strings instead of Array.join#186
repomaa merged 1 commit into
Crecto:masterfrom
repomaa:string_builder

Conversation

@repomaa
Copy link
Copy Markdown

@repomaa repomaa commented Aug 22, 2018

fixes #181

@repomaa repomaa force-pushed the string_builder branch 5 times, most recently from 435ad7d to 3e439c6 Compare August 22, 2018 19:22
@repomaa repomaa mentioned this pull request Aug 22, 2018
@repomaa repomaa requested a review from fridgerator August 22, 2018 20:46
@repomaa
Copy link
Copy Markdown
Author

repomaa commented Aug 22, 2018

i'd be interested in a benchmark as well :)

@repomaa repomaa force-pushed the string_builder branch 2 times, most recently from 3aeb206 to 23441d6 Compare August 24, 2018 11:56
@fridgerator
Copy link
Copy Markdown
Member

Here are the benchmark results I get on this branch:

                           user     system      total        real
insert crecto :        0.530000   0.220000   0.750000 (  3.596781)
insert crystal-pg :    0.120000   0.120000   0.240000 (  2.957929)
                          user     system      total        real
update crecto :       0.680000   0.210000   0.890000 (  5.045013)
update crystal-pg :   0.170000   0.160000   0.340000 (  4.014328)
                           user     system      total        real
delete crecto :        0.390000   0.260000   0.650000 (  5.389259)
delete crystal-pg :    0.110000   0.150000   0.260000 (  3.905372)
                               user     system      total        real
select where crecto:       0.180000   0.140000   0.320000 (  1.931654)
select where crystal-pg:   0.090000   0.120000   0.210000 (  1.817702)

Compared to: https://github.com/Crecto/crecto/wiki/Benchmarks

So looks like a bit a performance increase.

@fridgerator
Copy link
Copy Markdown
Member

FYI i'm just compiling this file with --release flag to benchmark

@repomaa repomaa merged commit ae677e5 into Crecto:master Aug 27, 2018
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.

Look into using string builder rather than array concatenation for query building

2 participants