-
Notifications
You must be signed in to change notification settings - Fork 94
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
JaceOptions case sensitivity does not get applied to FunctionRegistry or ConstantRegistry on engine constructor #75
Comments
I also ran the Jace benchmarks as those seemed to allow testing performance with and without case sensitivity. The tests are neclecting to test the basic use case though that does not use the I created some new benchmark cases to see the performance impact. The rightmost column ("Total Duration (no fix)") has results before fix and the one before that ("Total Duration (fix)") has fix to engine constructor applied. An improvement of ~200 ms can be observed in cases where case sensitivity is set to True.
|
Here are also the full excel files before and after the fix. Note that only the benchmarks with formula "something2 - (var1 var2 * 3)/(2 3)" are affected when case sensitivity is True. jace_benchmark_var_dict_no_fix.xlsx |
When CaseSensitive is set to true from JaceOptions, performance should be significantly better than without case sensitivity. Case sensitivity setting was not passed to `FunctionRegistry` and `ConstantRegistry` constructors, which caused them to do extra lower case conversions in case variable dictionary was passed to the formula. Fixes [issue pieterderycke#75][1]. New benchmark was created to verify the fix. Benchmark needs to have variables which are provided to `CalculationEngine.Calculate()`, so VerifyVariableNames() gets called, which causes the extra calls to `ToLowerFast()`. Below results show ~200 ms improvement when Case Sensitive is true. Results table was created by running benchmark separately with and without fix and copying results to one table. | Engine | Case Sensitive | Formula | Total Iteration | Total Duration (fix) | Total Duration (no fix) | |------------|----------------|---------|-----------------|------------------------|-------------------------| | Interpreted |False |something2 - (var1 var2 * 3)/(2 3) |1000000|00:00:01.6005267|00:00:01.5919016 | | Interpreted |True |something2 - (var1 var2 * 3)/(2 3) |1000000|00:00:00.6069845|00:00:00.8390435 | | Compiled |False |something2 - (var1 var2 * 3)/(2 3) |1000000|00:00:01.5865326|00:00:01.5770084 | | Compiled |True |something2 - (var1 var2 * 3)/(2 3) |1000000|00:00:00.5930012|00:00:00.8189981 | Additionally: - Unit test which tests case sensitivity enabled throws when variable case does not match - Benchmark uses dictionary copy constructor to avoid throwing due to dictionary being modified with constants and then failing on `VerifyVariableNames()`. [1]: pieterderycke#75
@pieterderycke Created a PR #76 to fix the issue. |
FunctionRegistry and ConstantRegistry ignore
JaceOptions.CaseSensitive
, which has performance implications as there are lots of unnecessary calls toToLowerFast()
.Even after disabling case sensitivity, it gets checked by both
ConstantRegistry.IsConstantName()
andFunctionRegistryIsFunctionName()
.This does not seem to break the case sensitivity it self as even this test case I wrote to
CalculationEngineTests
passes:The text was updated successfully, but these errors were encountered: