Refactor/perf batch 8 - #702
Merged
Merged
Conversation
…factor/perf-batch-8 # Conflicts: # .Rbuildignore # NAMESPACE # R/utils.R # dsBase_7.0.0-permissive.tar.gz
⏳ 4 of 5 checks reported so far
Tested against Logs: Devtools checks · Code quality · Armadillo unit tests · Opal unit tests · Codecov |
There was a problem hiding this comment.
lintr found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v7.0-dev #702 +/- ##
============================================
+ Coverage 60.87% 61.16% +0.28%
============================================
Files 142 142
Lines 6365 6120 -245
============================================
- Hits 3875 3743 -132
+ Misses 2490 2377 -113
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…factor/perf-batch-8
…lient into refactor/perf-batch-8
StuartWheater
approved these changes
Sep 16, 2026
StuartWheater
left a comment
Member
There was a problem hiding this comment.
- "Failure ('test-perf-ds.Boole.R:40:5'): performance" issue is addressed by stage 9/10.
- Changes to code and tests appear correct, both restructuring and code tweeks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Batch 8 of the performance refactor covers the random-number and sampling functions:
ds.rBinom,ds.rNorm,ds.rPois,ds.rUnif,ds.sampleandds.setSeed. It moves object checks to the server, replaceseval(parse())with safe object loading and removes the extra MODULE 5 checks.In the process of refactor, whilst switching pasting text to
call(), it became clear that despite the docs stating that each study would be passed its own values from argumentssize,prob,mean,sd,force.output.to.k.decimal.places, the code never actually did this. This has been fixed: see table below for change in behaviour.Specific changes to fix this silent code failure
This table summarises the previous behaviour and the new behaviour:
mean = 5rNormDS(50,5,1,9)mean = 5/5/5mean = c(1, 6, 4)rNormDS(50,1,1,9)(only the first value, silently)mean = 1/6/4mean = c(1, 6)(wrong length)rNormDS(50,1,1,9)(only the first value, silently)'mean' must be length 1 or one value per studymean = "D$LAB_TSC"(server-side name)rNormDS(50,D$LAB_TSC,1,9), evaluated on the servermean = "D$LAB_TSC"/ same / same, loaded safelymean = c("m1", "m2", "m3")(one name per study)rNormDS(50,m1,1,9)(only the first name)mean = "m1"/"m2"/"m3"mean = "5"(number as text)rNormDS(50,5,1,9), run as the number 5mean = "5", which errors on the server:'5' does not existmean = "D$x*2"(expression as text)rNormDS(50,D$x*2,1,9), run as codemean = "D$x*2", which errors on the server: object not foundsamp.size = c(10, 20, 45)rNormDS(10,...)/rNormDS(20,...)/rNormDS(45,...)10/20/45The same applies to:
ds.rBinom:size,probds.rNorm:mean,sd,force.output.to.k.decimal.placesds.rPois:lambdads.rUnif:min,max,force.output.to.k.decimal.placesStandard changes as part of refactor
rBinomDS,rNormDS,rPoisDS,rUnifDSandsampleDSload object-name arguments with.loadServersideObject(); a missing object errors with "does not exist".setSeedDSreads the seed withas.integer()instead ofeval(parse()).call()instead of pasted text.set_datasources()Tests added:
setSeedDSwith"NULL"and non-numeric seeds.test-arg-per-study-arguments.R(no server needed): checks exactly what each study is sent.@returncorrected,@paramstates the per-study rule, and the examples use numeric vectors instead ofas.character(c(...)).How to test