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

use bison cpp API to support non-trivial types #1805

Merged
merged 3 commits into from Jun 7, 2021

Conversation

lkeegan
Copy link
Member

@lkeegan lkeegan commented Jun 7, 2021

@lkeegan
Copy link
Member Author

lkeegan commented Jun 7, 2021

It doesn't seem to be slower than the C version, if anything it seems a bit faster for long expressions:

master benchmarks:

First call (initialization)
parse('0') = 0: 13us
Subsequent calls
1us 1us 1us 0us 0us 0us 0us 0us 0us 0us 

Single long benchmark
24ms
(x + y - sin(x)/(-4 + z**2) - x**(y**z))**5001
54ms
(x + y - sin(x)/(-4 + z**2) - x**(y**z))**5001

Repeated short benchmark
15ms
58ms

----------------------------------------------------------------
Benchmark                      Time             CPU   Iterations
----------------------------------------------------------------
parse_0                      723 ns          723 ns       938663
parse_long_expr1/2         10491 ns        10491 ns        66628
parse_long_expr1/8         40238 ns        40238 ns        17423
parse_long_expr1/64       316114 ns       316107 ns         2215
parse_long_expr1/512     2512923 ns      2512878 ns          278
parse_long_expr1/4096   20061868 ns     20061528 ns           35
parse_long_expr1_BigO    4898.08 N       4898.00 N    
parse_long_expr1_RMS           0 %             0 %    
parse_long_expr2/2         12544 ns        12544 ns        55851
parse_long_expr2/8         48027 ns        48026 ns        14578
parse_long_expr2/64       382332 ns       382323 ns         1829
parse_long_expr2/512     3019267 ns      3019182 ns          234
parse_long_expr2/4096   24042647 ns     24042204 ns           29
parse_long_expr2_BigO    5870.23 N       5870.12 N    
parse_long_expr2_RMS           0 %             0 %    

this PR:

First call (initialization)
parse('0') = 0: 12us
Subsequent calls
2us 1us 1us 1us 1us 1us 1us 1us 1us 1us 

Single long benchmark
21ms
(x + y - sin(x)/(-4 + z**2) - x**(y**z))**5001
56ms
(x + y - sin(x)/(-4 + z**2) - x**(y**z))**5001

Repeated short benchmark
14ms
59ms

----------------------------------------------------------------
Benchmark                      Time             CPU   Iterations
----------------------------------------------------------------
parse_0                      737 ns          737 ns       954650
parse_long_expr1/2         10704 ns        10704 ns        65326
parse_long_expr1/8         37873 ns        37871 ns        18530
parse_long_expr1/64       285630 ns       285626 ns         2433
parse_long_expr1/512     2251805 ns      2251708 ns          308
parse_long_expr1/4096   17879598 ns     17879332 ns           39
parse_long_expr1_BigO    4365.67 N       4365.60 N    
parse_long_expr1_RMS           0 %             0 %    
parse_long_expr2/2         12311 ns        12311 ns        56786
parse_long_expr2/8         43450 ns        43449 ns        16036
parse_long_expr2/64       329430 ns       329425 ns         2124
parse_long_expr2/512     2603440 ns      2603424 ns          270
parse_long_expr2/4096   20820959 ns     20820461 ns           34
parse_long_expr2_BigO    5083.28 N       5083.16 N    
parse_long_expr2_RMS           0 %             0 %    

@lkeegan lkeegan merged commit c05404d into symengine:master Jun 7, 2021
@lkeegan lkeegan deleted the bison_stack_reallocation branch June 12, 2021 06:19
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.

segfault when parsing long expression
2 participants