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

Implement GetStripedOffsets #1323

Merged
merged 23 commits into from
Apr 1, 2020
Merged

Conversation

mstoykov
Copy link
Contributor

The idea of this PR is to

  1. Basic review of the algorithm - it is fairly short so it shouldn't take long and the basics of the implementations are hardly going to change.
  2. Discuss whether it should be implemented as it is or should we basically calculate it for every segment so that it can be used in a future distributed mode? It really won't be much more code and will add some memory overhead but nothing big really.
  3. I think the returned values should be a list offsets(where the first one is the start) and the second the LCD, as you would otherwise need to calculate it again ... and there is really no point in having start and offsets as separate values.

@mstoykov mstoykov requested review from imiric and na-- January 30, 2020 10:34
@codecov-io
Copy link

codecov-io commented Jan 30, 2020

Codecov Report

Merging #1323 into new-schedulers will increase coverage by 0.12%.
The diff coverage is 86.59%.

Impacted file tree graph

@@                Coverage Diff                 @@
##           new-schedulers    #1323      +/-   ##
==================================================
+ Coverage           76.30%   76.42%   +0.12%     
==================================================
  Files                 161      161              
  Lines               12625    12799     +174     
==================================================
+ Hits                 9633     9782     +149     
- Misses               2482     2500      +18     
- Partials              510      517       +7     
Impacted Files Coverage Δ
cmd/run.go 8.73% <0.00%> (ø)
cmd/options.go 63.33% <10.00%> (-3.81%) ⬇️
lib/options.go 87.69% <14.28%> (-5.72%) ⬇️
lib/executor/externally_controlled.go 58.82% <60.00%> (ø)
core/local/local.go 70.17% <66.66%> (-0.50%) ⬇️
lib/executor/variable_arrival_rate.go 96.20% <89.47%> (ø)
lib/execution_segment.go 91.05% <93.52%> (+4.15%) ⬆️
lib/execution.go 91.79% <100.00%> (+0.06%) ⬆️
lib/executor/constant_arrival_rate.go 97.35% <100.00%> (+0.31%) ⬆️
lib/executor/constant_looping_vus.go 96.42% <100.00%> (-0.05%) ⬇️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b14db8e...c2f3163. Read the comment docs.

Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're calculating the offsets in a way that's not very useful. My original idea with the algorithm was to have a start and a slice of increments/offsets, but instead of offsets being the specific indexes i, for them to be numbers that you could easily use in a for loop.

See how I calculated this here: https://play.golang.org/p/NFTzwlHTXFw

lib/execution_segment.go Outdated Show resolved Hide resolved
lib/execution_segment.go Outdated Show resolved Hide resolved
lib/execution_segment.go Outdated Show resolved Hide resolved
lib/execution_segment.go Outdated Show resolved Hide resolved
lib/execution_segment.go Outdated Show resolved Hide resolved
}
}
if matchingSegment == nil {
return -1, nil, fmt.Errorf("missing segment %s inside segment sequence %s", segment, ess) // TODO: make a seperate error ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would have to be validated somewhere higher up as well, after the options consolidation. This check would just be insurance, I guess, so I think there's no need

lib/execution_segment.go Outdated Show resolved Hide resolved
@na--
Copy link
Member

na-- commented Jan 30, 2020

Basically, my increments from the above example has length of len(offsets)+1, and :

  • increments[0] = offsets[0] - start
  • increments[1] = offsets[1] - offsets[0]
  • ...
  • increments[n+1] = denominator + start - offsets[n]` (I think? basically, how long you have to wrap around from the last offset back to the start)

@mstoykov
Copy link
Contributor Author

mstoykov commented Feb 4, 2020

There are benchstat outputs in each commit after the benchmarks were added but from the first to the current one the results are :

name                                   old time/op    new time/op    delta
GetStripedOffsets/length10,seed777-4     58.9µs ±41%    28.8µs ±31%  -51.20%  (p=0.000 n=50+50)
GetStripedOffsets/length100,seed777-4    19.3ms ±19%     4.8ms ±14%  -75.25%  (p=0.000 n=49+50)
GetStripedOffsetsEven/length10-4         10.4µs ± 2%     4.9µs ± 3%  -52.23%  (p=0.000 n=43+44)
GetStripedOffsetsEven/length100-4         395µs ± 2%      58µs ± 4%  -85.38%  (p=0.000 n=43+43)
GetStripedOffsetsEven/length1000-4       32.5ms ± 2%     0.9ms ± 6%  -97.19%  (p=0.000 n=43+43)

name                                   old alloc/op   new alloc/op   delta
GetStripedOffsets/length10,seed777-4     21.7kB ±54%    10.8kB ±22%  -50.25%  (p=0.000 n=50+49)
GetStripedOffsets/length100,seed777-4    9.82MB ±21%    0.66MB ± 9%  -93.28%  (p=0.000 n=48+50)
GetStripedOffsetsEven/length10-4         3.93kB ± 0%    3.19kB ± 0%  -18.74%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length100-4         116kB ± 0%      36kB ± 0%  -69.32%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length1000-4       8.35MB ± 0%    0.34MB ± 0%  -95.95%  (p=0.000 n=46+45)

name                                   old allocs/op  new allocs/op  delta
GetStripedOffsets/length10,seed777-4      1.07k ±42%     0.34k ±25%  -68.09%  (p=0.000 n=50+50)
GetStripedOffsets/length100,seed777-4      389k ±17%       22k ±10%  -94.27%  (p=0.000 n=48+50)
GetStripedOffsetsEven/length10-4            233 ± 0%        87 ± 0%  -62.66%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length100-4         11.4k ± 0%      0.9k ± 0%  -92.26%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length1000-4        1.01M ± 0%     0.01M ± 0%  -99.17%  (p=0.000 n=50+50)

mstoykov added a commit that referenced this pull request Feb 4, 2020
@na-- na-- mentioned this pull request Feb 5, 2020
@mstoykov mstoykov changed the base branch from execution-segment-sequences to new-schedulers February 5, 2020 07:37
@mstoykov mstoykov force-pushed the GetStripedOffsetsImplementation branch from 12246b4 to c5fd0c5 Compare February 5, 2020 12:47
@mstoykov mstoykov marked this pull request as ready for review February 5, 2020 14:32
@mstoykov mstoykov changed the title WIP Implement GetStripedOffsets Implement GetStripedOffsets Feb 5, 2020
@mstoykov mstoykov force-pushed the GetStripedOffsetsImplementation branch from c5fd0c5 to d093a4a Compare February 20, 2020 16:47
Copy link
Contributor

@imiric imiric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor things and nitpicks. Evaluating the correctness of the algorithm is a bit difficult for me right now as this functionality is not used yet, but I'll compare it to the spreadsheet and play around with it some more.

lib/execution_segment.go Outdated Show resolved Hide resolved
lib/execution_segment.go Outdated Show resolved Hide resolved
lib/execution_segment.go Outdated Show resolved Hide resolved
lib/execution_segment.go Outdated Show resolved Hide resolved
}
startTime = time.Now()
timer := time.NewTimer(time.Hour * 24)
// here the we need the not scaled one
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typos?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// here the we need the not scaled one
// here the we need the not-scaled one

or

Suggested change
// here the we need the not scaled one
// here the we need the unscaled one

@@ -54,6 +54,7 @@ func optionFlagSet() *pflag.FlagSet {
flags.Int64P("iterations", "i", 0, "script total iteration limit (among all VUs)")
flags.StringSliceP("stage", "s", nil, "add a `stage`, as `[duration]:[target]`")
flags.String("execution-segment", "", "limit execution to the specified segment, e.g. 10%, 1/3, 0.2:2/3")
flags.String("execution-segment-sequence", "", "the execution segment sequence") // TODO better description
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should leave that one undocumented for now, considering that it might confuse people a lot? There's a Hidden field in pflag.Flag, though we should probably just write a proper long tutorial for how execution segments work after we release them...

lib/options.go Outdated
ExecutionSegment *ExecutionSegment `json:"executionSegment" ignored:"true"`
Execution ExecutorConfigMap `json:"execution,omitempty" ignored:"true"`
ExecutionSegment *ExecutionSegment `json:"executionSegment" ignored:"true"`
ESS *ExecutionSegmentSequence `json:"executionSegmentSequence" ignored:"true"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little bit bikesheddy, but why not just use ExecutionSegmentSequence as the variable name as well? 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly it was too long for me to type out when I was adding it and ... well I haven't renamed it since ;)

lib/execution_segment.go Outdated Show resolved Hide resolved
lib/execution_segment.go Outdated Show resolved Hide resolved
lib/execution_segment.go Outdated Show resolved Hide resolved
@mstoykov
Copy link
Contributor Author

@imiric it is used in the constant arrival rate executor d093a4a . You can look at the added test for the executor, they show what happens :)

Copy link
Contributor

@imiric imiric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor things and questions. I spotted a few typos, but we can live with those :)

The additional documentation really helps, thanks. Could we link to your gist math paper somewhere as well?

if int64(len(et.offsetsCache[index])) == numerator {
et.offsetsCache[index] = append(et.offsetsCache[index], et.offsetsCache[index][0]+wrapper.lcd-iteration)
}
return false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm interpreting this correctly, this lambda will always return false and the break outer on L493 would never be triggered, correct? If so, we could remove the label and check from stripingAlgorithm, and the return from here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was needed if you wanted to calculate only for one segment in order to short circuit the whole calculation ... if we decide that functionality will never be needed - I will remove it, but I prefer to wait for @na-- to write down what he thinks and then if this is not needed we can drop it.

// As additional note the sorting of the segments from biggest to smallest helps with the fact that
// the biggest elements will need to take the most elements and for them it will be the hardest to
// not get sequential elements.
func (e sortInterfaceWrapper) stripingAlgorithm(saveIndex func(iteration int64, index int, numerator int64) bool) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider dropping the Algorithm from the name here. All functions implement "algorithms" :)

Maybe just stripe()?

Also, it could be just me, but I'm not sure I find splitting the implementation into this receiving a lambda is more readable or easier to understand. It essentially moves the "meat" of this algorithm to an external function, which is convenient if this helps with reusing it for other scenarios other than splitting iterations, but it currently dilutes the purpose of this function. Not a big deal, but unless making it generic is a priority, it would be easier to follow if it's embedded as in the original version. After all, we don't gain much by moving it to another place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for dropping Algorithm and stripe sounds even better.

This is for 2 reasons:

  1. This is artefact of how it was previously and during the rewrites. As we are running out of time and this is only part of the work needed, and I needed feedback ... in more general sense and there is also
  2. While this currently isn't used as I calculate all offsets once and then cache it ... maybe we will want to revert to using the other variant - this will depend both on how much we think that caching actually speedups stuff and what we need in the other executors ... which are both connected.

So I would prefer if we add a TODO to refactor this once we have fixed all the functional issues and probably have gain some experience about what is needed.

lib/execution_segment_test.go Show resolved Hide resolved
lib/execution_segment_test.go Outdated Show resolved Hide resolved
lib/execution_segment_test.go Show resolved Hide resolved
name                                   time/op
GetStripedOffsets/length10,seed777-4   58.9µs ±41%
GetStripedOffsets/length100,seed777-4  19.3ms ±19%
GetStripedOffsetsEven/length10-4       10.4µs ± 2%
GetStripedOffsetsEven/length100-4       395µs ± 2%
GetStripedOffsetsEven/length1000-4     32.5ms ± 2%

name                                   alloc/op
GetStripedOffsets/length10,seed777-4   21.7kB ±54%
GetStripedOffsets/length100,seed777-4  9.82MB ±21%
GetStripedOffsetsEven/length10-4       3.93kB ± 0%
GetStripedOffsetsEven/length100-4       116kB ± 0%
GetStripedOffsetsEven/length1000-4     8.35MB ± 0%

name                                   allocs/op
GetStripedOffsets/length10,seed777-4    1.07k ±42%
GetStripedOffsets/length100,seed777-4    389k ±17%
GetStripedOffsetsEven/length10-4          233 ± 0%
GetStripedOffsetsEven/length100-4       11.4k ± 0%
GetStripedOffsetsEven/length1000-4      1.01M ± 0%
name                                   old time/op    new time/op delta
GetStripedOffsets/length10,seed777-4     58.9µs ±41%    47.3µs ±35% -19.67%  (p=0.000 n=50+49)
GetStripedOffsets/length100,seed777-4    19.3ms ±19%    18.6ms ±23% ~     (p=0.058 n=49+50)
GetStripedOffsetsEven/length10-4         10.4µs ± 2%    10.9µs ± 2% +5.37%  (p=0.000 n=43+44)
GetStripedOffsetsEven/length100-4         395µs ± 2%     400µs ± 2% +1.32%  (p=0.000 n=43+42)
GetStripedOffsetsEven/length1000-4       32.5ms ± 2%    32.9ms ± 2% +1.37%  (p=0.000 n=43+44)

name                                   old alloc/op   new alloc/op delta
GetStripedOffsets/length10,seed777-4     21.7kB ±54%    20.4kB ±47% ~     (p=0.179 n=50+50)
GetStripedOffsets/length100,seed777-4    9.82MB ±21%   10.09MB ±21% ~     (p=0.143 n=48+50)
GetStripedOffsetsEven/length10-4         3.93kB ± 0%    4.65kB ± 0% +18.33%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length100-4         116kB ± 0%     123kB ± 0% +6.30%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length1000-4       8.35MB ± 0%    8.42MB ± 0% +0.86%  (p=0.000 n=46+49)

name                                   old allocs/op  new allocs/op delta
GetStripedOffsets/length10,seed777-4      1.07k ±42%     0.88k ±38% -17.98%  (p=0.000 n=50+50)
GetStripedOffsets/length100,seed777-4      389k ±17%      381k ±21% ~     (p=0.246 n=48+50)
GetStripedOffsetsEven/length10-4            233 ± 0%       244 ± 0% +4.72%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length100-4         11.4k ± 0%     11.5k ± 0% +0.89%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length1000-4        1.01M ± 0%     1.01M ± 0% +0.10%  (p=0.000 n=50+50)
name                                   old time/op    new time/op    delta
GetStripedOffsets/length10,seed777-4     47.3µs ±35%    48.6µs ±37%    ~     (p=0.694 n=49+50)
GetStripedOffsets/length100,seed777-4    18.6ms ±23%    18.9ms ±20%    ~     (p=0.557 n=50+50)
GetStripedOffsetsEven/length10-4         10.9µs ± 2%    11.0µs ± 3%  +1.01%  (p=0.000 n=44+41)
GetStripedOffsetsEven/length100-4         400µs ± 2%     411µs ± 5%  +2.71%  (p=0.000 n=42+42)
GetStripedOffsetsEven/length1000-4       32.9ms ± 2%    32.9ms ± 3%    ~     (p=0.718 n=44+44)

name                                   old alloc/op   new alloc/op   delta
GetStripedOffsets/length10,seed777-4     20.4kB ±47%    20.2kB ±45%    ~     (p=0.683 n=50+50)
GetStripedOffsets/length100,seed777-4    10.1MB ±21%    10.0MB ±14%    ~     (p=0.515 n=50+47)
GetStripedOffsetsEven/length10-4         4.65kB ± 0%    4.65kB ± 0%    ~     (all equal)
GetStripedOffsetsEven/length100-4         123kB ± 0%     123kB ± 0%    ~     (all equal)
GetStripedOffsetsEven/length1000-4       8.42MB ± 0%    8.42MB ± 0%    ~     (p=0.556 n=49+47)

name                                   old allocs/op  new allocs/op  delta
GetStripedOffsets/length10,seed777-4        881 ±38%       887 ±35%    ~     (p=0.896 n=50+50)
GetStripedOffsets/length100,seed777-4      381k ±21%      377k ±14%    ~     (p=0.617 n=50+47)
GetStripedOffsetsEven/length10-4            244 ± 0%       244 ± 0%    ~     (all equal)
GetStripedOffsetsEven/length100-4         11.5k ± 0%     11.5k ± 0%    ~     (all equal)
GetStripedOffsetsEven/length1000-4        1.01M ± 0%     1.01M ± 0%    ~     (all equal)
name                                   old time/op    new time/op    delta
GetStripedOffsets/length10,seed777-4     48.6µs ±37%    44.5µs ±38%   -8.48%  (p=0.021 n=50+49)
GetStripedOffsets/length100,seed777-4    18.9ms ±20%    17.9ms ±18%   -5.49%  (p=0.004 n=50+50)
GetStripedOffsetsEven/length10-4         11.0µs ± 3%     7.2µs ± 5%  -34.87%  (p=0.000 n=41+43)
GetStripedOffsetsEven/length100-4         411µs ± 5%     104µs ± 3%  -74.70%  (p=0.000 n=42+45)
GetStripedOffsetsEven/length1000-4       32.9ms ± 3%     2.5ms ± 7%  -92.53%  (p=0.000 n=44+42)

name                                   old alloc/op   new alloc/op   delta
GetStripedOffsets/length10,seed777-4     20.2kB ±45%    19.5kB ±45%     ~     (p=0.334 n=50+50)
GetStripedOffsets/length100,seed777-4    10.0MB ±14%     9.7MB ±20%   -3.14%  (p=0.027 n=47+50)
GetStripedOffsetsEven/length10-4         4.65kB ± 0%    3.78kB ± 0%  -18.59%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length100-4         123kB ± 0%      50kB ± 0%  -59.16%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length1000-4       8.42MB ± 0%    0.83MB ± 0%  -90.09%  (p=0.000 n=47+33)

name                                   old allocs/op  new allocs/op  delta
GetStripedOffsets/length10,seed777-4        887 ±35%       806 ±37%   -9.13%  (p=0.007 n=50+50)
GetStripedOffsets/length100,seed777-4      377k ±14%      361k ±18%   -4.13%  (p=0.005 n=47+50)
GetStripedOffsetsEven/length10-4            244 ± 0%       136 ± 0%  -44.26%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length100-4         11.5k ± 0%      2.4k ± 0%  -79.13%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length1000-4        1.01M ± 0%     0.07M ± 0%  -93.44%  (p=0.000 n=50+50)
name                                   old time/op    new time/op    delta
GetStripedOffsets/length10,seed777-4     42.3µs ±43%    28.8µs ±31%  -32.06%  (p=0.000 n=50+50)
GetStripedOffsets/length100,seed777-4    18.0ms ±24%     4.8ms ±14%  -73.40%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length10-4         5.47µs ± 3%    4.95µs ± 3%   -9.55%  (p=0.000 n=42+44)
GetStripedOffsetsEven/length100-4        86.9µs ± 6%    57.7µs ± 4%  -33.55%  (p=0.000 n=44+43)
GetStripedOffsetsEven/length1000-4       2.28ms ± 9%    0.91ms ± 6%  -60.03%  (p=0.000 n=44+43)

name                                   old alloc/op   new alloc/op   delta
GetStripedOffsets/length10,seed777-4     18.3kB ±51%    10.8kB ±22%  -40.93%  (p=0.000 n=50+49)
GetStripedOffsets/length100,seed777-4    9.71MB ±17%    0.66MB ± 9%  -93.21%  (p=0.000 n=47+50)
GetStripedOffsetsEven/length10-4         3.21kB ± 0%    3.19kB ± 0%   -0.50%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length100-4        44.0kB ± 0%    35.5kB ± 0%  -19.14%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length1000-4        771kB ± 0%     338kB ± 0%  -56.11%  (p=0.000 n=40+45)

name                                   old allocs/op  new allocs/op  delta
GetStripedOffsets/length10,seed777-4        759 ±35%       343 ±25%  -54.80%  (p=0.000 n=48+50)
GetStripedOffsets/length100,seed777-4      366k ±23%       22k ±10%  -93.91%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length10-4            109 ± 0%        87 ± 0%  -20.18%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length100-4         2.10k ± 0%     0.88k ± 0%  -58.05%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length1000-4        63.6k ± 0%      8.4k ± 0%  -86.80%  (p=0.000 n=50+50)
name                                   old time/op    new time/op    delta
GetStripedOffsets/length10,seed777-4     28.8µs ±31%    25.6µs ±32%  -10.91%  (p=0.000 n=50+50)
GetStripedOffsets/length100,seed777-4    4.78ms ±14%    4.86ms ±11%     ~     (p=0.121 n=50+45)
GetStripedOffsetsEven/length10-4         4.95µs ± 3%    3.94µs ± 3%  -20.34%  (p=0.000 n=44+43)
GetStripedOffsetsEven/length100-4        57.7µs ± 4%    44.6µs ± 2%  -22.76%  (p=0.000 n=43+41)
GetStripedOffsetsEven/length1000-4        912µs ± 6%     776µs ± 4%  -14.89%  (p=0.000 n=43+43)

name                                   old alloc/op   new alloc/op   delta
GetStripedOffsets/length10,seed777-4     10.8kB ±22%     7.9kB ±21%  -26.81%  (p=0.000 n=49+47)
GetStripedOffsets/length100,seed777-4     660kB ± 9%     579kB ±11%  -12.25%  (p=0.000 n=50+49)
GetStripedOffsetsEven/length10-4         3.19kB ± 0%    2.34kB ± 0%  -26.57%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length100-4        35.5kB ± 0%    23.8kB ± 0%  -32.91%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length1000-4        338kB ± 0%     220kB ± 0%  -34.88%  (p=0.000 n=45+46)

name                                   old allocs/op  new allocs/op  delta
GetStripedOffsets/length10,seed777-4        343 ±25%       279 ±22%  -18.59%  (p=0.000 n=50+47)
GetStripedOffsets/length100,seed777-4     22.3k ±10%     20.6k ±10%   -7.65%  (p=0.000 n=50+49)
GetStripedOffsetsEven/length10-4           87.0 ± 0%      68.0 ± 0%  -21.84%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length100-4           883 ± 0%       638 ± 0%  -27.75%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length1000-4        8.40k ± 0%     5.94k ± 0%  -29.28%  (p=0.000 n=50+50)
This one handles ... more elegantly all cases where the execution
segmetn sequence isn't full or missing at all. This is mostly done
through the fact that the algorithm works even if we don't fill the
sequence as long as we don't care about whether 0:1/3 and 1/3:2/3 get
the same offsets when there is no sequence provided. If we care about
that we need to fill the sequence which will be more involved but not by
much :D.

The other thing is that the construction of the numerator, steps and so
on arrays is separate from the actual algorithm of calculating the
offsets which at least makes silence golangci-lint. I would argue also
makes it easier to read.
name                                   old time/op    new time/op    delta
GetStripedOffsets/length10,seed777-4     23.8µs ±34%     4.5µs ±48%  -81.12%  (p=0.000 n=50+48)
GetStripedOffsets/length100,seed777-4    4.54ms ±15%    1.94ms ±21%  -57.14%  (p=0.000 n=49+50)
GetStripedOffsetsEven/length10-4         3.92µs ± 2%    1.15µs ± 2%  -70.68%  (p=0.000 n=43+43)
GetStripedOffsetsEven/length100-4        42.4µs ± 2%    15.0µs ± 1%  -64.54%  (p=0.000 n=43+43)
GetStripedOffsetsEven/length1000-4        726µs ± 1%     377µs ± 1%  -48.11%  (p=0.000 n=41+44)

name                                   old alloc/op   new alloc/op   delta
GetStripedOffsets/length10,seed777-4     7.94kB ±30%    0.98kB ±37%  -87.63%  (p=0.000 n=50+50)
GetStripedOffsets/length100,seed777-4     584kB ±11%      10kB ±25%  -98.22%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length10-4         2.42kB ± 0%    0.58kB ± 0%  -76.16%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length100-4        23.9kB ± 0%     5.9kB ± 0%  -75.32%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length1000-4        220kB ± 0%      47kB ± 0%  -78.67%  (p=0.000 n=48+50)

name                                   old allocs/op  new allocs/op  delta
GetStripedOffsets/length10,seed777-4        278 ±32%        25 ±67%  -90.99%  (p=0.000 n=50+50)
GetStripedOffsets/length100,seed777-4     20.8k ±11%      0.2k ±54%  -98.93%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length10-4           71.0 ± 0%      12.0 ± 0%  -83.10%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length100-4           641 ± 0%        72 ± 0%  -88.77%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length1000-4        5.94k ± 0%     0.47k ± 0%  -92.06%  (p=0.000 n=50+50)
Very small speed up but it does also drop the memory usage in not "even"
sequences.
There are better algorithms for calculating the gcd but unless there are
some quite big and divers denominators this will have very small
perfomance impact if at all.

name                                   old time/op    new time/op    delta
GetStripedOffsets/length10,seed777-4     4.50µs ±48%    3.48µs ±35%  -22.59%  (p=0.000 n=48+48)
GetStripedOffsets/length100,seed777-4    1.94ms ±21%    1.81ms ±16%   -6.87%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length10-4         1.15µs ± 2%    1.08µs ± 1%   -6.42%  (p=0.000 n=43+43)
GetStripedOffsetsEven/length100-4        15.0µs ± 1%    14.0µs ± 4%   -6.80%  (p=0.000 n=43+43)
GetStripedOffsetsEven/length1000-4        377µs ± 1%     351µs ± 1%   -6.80%  (p=0.000 n=44+44)

name                                   old alloc/op   new alloc/op   delta
GetStripedOffsets/length10,seed777-4       983B ±37%      764B ± 2%  -22.20%  (p=0.000 n=50+48)
GetStripedOffsets/length100,seed777-4    10.4kB ±25%     7.9kB ± 3%  -23.90%  (p=0.000 n=50+49)
GetStripedOffsetsEven/length10-4           576B ± 0%      576B ± 0%     ~     (all equal)
GetStripedOffsetsEven/length100-4        5.90kB ± 0%    5.90kB ± 0%     ~     (all equal)
GetStripedOffsetsEven/length1000-4       47.0kB ± 0%    47.0kB ± 0%     ~     (all equal)

name                                   old allocs/op  new allocs/op  delta
GetStripedOffsets/length10,seed777-4       25.1 ±67%      15.0 ± 0%  -40.19%  (p=0.000 n=50+50)
GetStripedOffsets/length100,seed777-4       222 ±54%       105 ± 5%  -52.88%  (p=0.000 n=50+48)
GetStripedOffsetsEven/length10-4           12.0 ± 0%      12.0 ± 0%     ~     (all equal)
GetStripedOffsetsEven/length100-4          72.0 ± 0%      72.0 ± 0%     ~     (all equal)
GetStripedOffsetsEven/length1000-4          472 ± 0%       472 ± 0%     ~     (all equal)
This required some interface changes as well as a lot of test
retouching.

There is somewhat significant perfomance degradation which comes from
the fact that now we calculate the offset for everything once, this
should be negligible in the cases where it is not needed and when it is
it is going to significantly speed up the execution.

The constant arrival rate executor has been used to showcase how the
striping algorithm should be used.

name                                   old time/op    new time/op    delta
GetStripedOffsets/length10,seed777-4     3.64µs ±40%    5.56µs ±33%    +52.95%  (p=0.000 n=50+50)
GetStripedOffsets/length100,seed777-4    1.97ms ±21%    1.89ms ±18%     -3.98%  (p=0.046 n=50+50)
GetStripedOffsetsEven/length10-4         1.06µs ± 2%    2.67µs ± 1%   +152.75%  (p=0.000 n=44+43)
GetStripedOffsetsEven/length100-4        14.3µs ± 1%    62.4µs ± 3%   +337.62%  (p=0.000 n=42+43)
GetStripedOffsetsEven/length1000-4        370µs ± 1%    4807µs ± 1%  +1198.18%  (p=0.000 n=44+45)

name                                   old alloc/op   new alloc/op   delta
GetStripedOffsets/length10,seed777-4       766B ± 2%     2144B ±17%   +180.06%  (p=0.000 n=50+50)
GetStripedOffsets/length100,seed777-4    7.90kB ± 3%  103.93kB ±11%  +1216.44%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length10-4           576B ± 0%     1392B ± 0%   +141.67%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length100-4        5.90kB ± 0%    9.55kB ± 0%    +61.79%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length1000-4       47.0kB ± 0%    82.5kB ± 0%    +75.59%  (p=0.000 n=50+50)

name                                   old allocs/op  new allocs/op  delta
GetStripedOffsets/length10,seed777-4       15.0 ± 0%      36.6 ±15%   +144.00%  (p=0.000 n=50+50)
GetStripedOffsets/length100,seed777-4       104 ± 5%       223 ± 7%   +113.13%  (p=0.000 n=50+49)
GetStripedOffsetsEven/length10-4           12.0 ± 0%      39.0 ± 0%   +225.00%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length100-4          72.0 ± 0%     225.0 ± 0%   +212.50%  (p=0.000 n=50+50)
GetStripedOffsetsEven/length1000-4          472 ± 0%      2031 ± 0%   +330.30%  (p=0.000 n=50+50)
@mstoykov mstoykov force-pushed the GetStripedOffsetsImplementation branch from 9fa61d9 to 005b855 Compare March 30, 2020 13:05
Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't fully finished with the code review, still have to fully review some of the trickier implementation details... In general everything mostly LGTM so far, I'm posting the minor nitpicks and comments I've currently got, so you can look through them and either respond or have something to work on while I review the rest.

core/local/local.go Outdated Show resolved Hide resolved
lib/options.go Show resolved Hide resolved
lib/executor/constant_arrival_rate.go Outdated Show resolved Hide resolved
lib/execution_segment.go Outdated Show resolved Hide resolved
lib/execution_segment.go Outdated Show resolved Hide resolved
}

func fillSequence(sequence ExecutionSegmentSequence) ExecutionSegmentSequence {
// TODO: discuss if we want to get the lcd of the sequence and fill with it elements of length 1/lcd ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, but I think your current approach may be the better one. My thoughts on this issue:

  1. If users just want to run a quickly scaled down version of their test by k6 run --execution-segment=0.1 heavy_test.js, then filling out the sequence with 1/lcd segments would be better. Because in that scenario the segment that the user configured would be larger than or equal to all other 1/lcd segments, its work will be optimally spread.
  2. On the other hand, in some cases, calculations would be quicker if we just fill out the sequence with max 2 segments, like how you currently do it. And the work distribution wouldn't be all that terrible, even if the user's segment isn't the biggest one... After all, that's sort of the whole idea 😅
  3. If users want to do a quick and dirty distributed execution by specifying --execution-segment without --execution-segment-sequence, then your current approach is also probably better in most cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is certainly the most straightforward one to explain as well ... because all the others get hairy with strange segments such as "1/3:2/5" or something like that ...

The biggest problem in my experience is that if you run it with "0:1/3", "1/3:2/3" and "2/3:1". the first and last behave the same while the middle one behaves as I have started to expect (which is not to say that it is wrong).
I don't think it is noticeable if you don't look for it and for the majority of the use cases I would argue this will work just the same :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The biggest problem in my experience is that if you run it with "0:1/3", "1/3:2/3" and "2/3:1". the first and last behave the same while the middle one behaves as I have started to expect (which is not to say that it is wrong).

But that's the thing - if you fill in the sequence with 1/lcd pieces, you'd get this nasty behavior pretty much all the time - equally sized segments would behave absolutely identically. So your current solution would be a better fit for them, I think... In any case, you probably should delete the TODO from here, to avoid confusion - we're not going to change the current implementation without some very good reason.

lib/execution_segment.go Show resolved Hide resolved
Comment on lines +80 to +85
return et.ScaleInt64(carc.PreAllocatedVUs.Int64)
}

// GetMaxVUs is just a helper method that returns the scaled max VUs.
func (carc ConstantArrivalRateConfig) GetMaxVUs(es *lib.ExecutionSegment) int64 {
return es.Scale(carc.MaxVUs.Int64)
func (carc ConstantArrivalRateConfig) GetMaxVUs(et *lib.ExecutionTuple) int64 {
return et.ScaleInt64(carc.MaxVUs.Int64)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These probably can be pre-calculated in the constructor, given how many times they are being used below? Something for the follow-up optimization pass perhas?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if we can merge this before I need to rebase it again :D

New benchmark results:

BenchmarkExecutionSegmentScale/seq:;segment:/segment.Scale(5)-8         	470435558	      2.53 ns/op	       0 B/op	       0 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:/et.Scale(5)-8              	  967018	      1233 ns/op	     440 B/op	      17 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:/et.Scale(5)_prefilled-8    	150010268	      7.94 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:/segment.Scale(5523)-8      	463766229	      2.93 ns/op	       0 B/op	       0 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:/et.Scale(5523)-8           	 1000000	      1277 ns/op	     440 B/op	      17 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:/et.Scale(5523)_prefilled-8 	83739726	      12.4 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:/segment.Scale(5000000)-8   	464901876	      3.03 ns/op	       0 B/op	       0 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:/et.Scale(5000000)-8        	  784173	      1309 ns/op	     440 B/op	      17 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:/et.Scale(5000000)_prefilled-8      148228074	      13.3 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:/segment.Scale(67280421310721)-8       	461219998	      2.74 ns/op	       0 B/op	       0 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:/et.Scale(67280421310721)-8            	  953570	      1224 ns/op	     440 B/op	      17 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:/et.Scale(67280421310721)_prefilled-8  	117047155	      12.6 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:0:1/segment.Scale(5)-8                 	  850756	      1422 ns/op	     320 B/op	      19 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:0:1/et.Scale(5)-8                      	  806138	      1733 ns/op	     632 B/op	      21 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:0:1/et.Scale(5)_prefilled-8            	154531297	      11.8 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:0:1/segment.Scale(5523)-8              	  926948	      1306 ns/op	     320 B/op	      19 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:0:1/et.Scale(5523)-8                   	  643215	      1694 ns/op	     632 B/op	      21 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:0:1/et.Scale(5523)_prefilled-8         	147420830	      7.77 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:0:1/segment.Scale(5000000)-8           	 1000000	      1329 ns/op	     320 B/op	      19 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:0:1/et.Scale(5000000)-8                	  692818	      1745 ns/op	     632 B/op	      21 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:0:1/et.Scale(5000000)_prefilled-8      	146246756	      7.82 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:0:1/segment.Scale(67280421310721)-8    	  829132	      1339 ns/op	     320 B/op	      19 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:0:1/et.Scale(67280421310721)-8         	  748573	      1760 ns/op	     632 B/op	      21 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:0:1/et.Scale(67280421310721)_prefilled-8      120025989	      14.9 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(5)-8                                584570	      1979 ns/op	     512 B/op	      28 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5)-8                                     333420	      3545 ns/op	    1432 B/op	      42 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5)_prefilled-8                         151765993	         7.75 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(5523)-8                             519910	      2113 ns/op	     624 B/op	      32 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5523)-8                                  311260	      3682 ns/op	    1432 B/op	      42 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5523)_prefilled-8                      140018670	         9.14 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(5000000)-8                          597290	      1980 ns/op	     512 B/op	      28 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5000000)-8                               289699	      3680 ns/op	    1432 B/op	      42 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5000000)_prefilled-8                   149898025	         7.77 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(67280421310721)-8                   539796	      2185 ns/op	     672 B/op	      33 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(67280421310721)-8                        347833	      3612 ns/op	    1432 B/op	      42 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(67280421310721)_prefilled-8            122449836	        11.3 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(5)-8                          610802	      2086 ns/op	     568 B/op	      30 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5)-8                                 1831	    730963 ns/op	  492833 B/op	      42 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5)_prefilled-8                   132629142	        12.4 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(5523)-8                       516368	      2294 ns/op	     672 B/op	      33 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5523)-8                              1519	    733097 ns/op	  492833 B/op	      42 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5523)_prefilled-8                  777319	      1370 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(5000000)-8                    554041	      2184 ns/op	     568 B/op	      30 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5000000)-8                           1500	    756885 ns/op	  492832 B/op	      42 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5000000)_prefilled-8               244622	      4696 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(67280421310721)-8             500317	      2334 ns/op	     720 B/op	      34 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(67280421310721)-8                    1624	    742685 ns/op	  492833 B/op	      42 allocs/op
BenchmarkExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(67280421310721)_prefilled-8        422404	      3310 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(5)-8         	  690877	      1675 ns/op	     424 B/op	      22 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5)-8              	  435661	      2644 ns/op	    1064 B/op	      29 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5)_prefilled-8    	139451774	      8.49 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(5523)-8      	  732109	      1593 ns/op	     424 B/op	      22 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5523)-8           	  448272	      2659 ns/op	    1064 B/op	      29 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5523)_prefilled-8 	147587318	      8.26 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(5000000)-8   	  840579	      1384 ns/op	     320 B/op	      19 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5000000)-8        	  469440	      2701 ns/op	    1064 B/op	      29 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5000000)_prefilled-8     129229272	      9.03 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(67280421310721)-8       	  844422	1494 ns/op	     376 B/op	      21 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(67280421310721)-8            	  435537	2651 ns/op	    1064 B/op	      29 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(67280421310721)_prefilled-8  	88344691	12.1 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(5)-8        	  733918	1606 ns/op	     376 B/op	      21 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5)-8             	  369414	3192 ns/op	    1208 B/op	      36 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5)_prefilled-8   	141027226	9.66 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(5523)-8     	  789291	1544 ns/op	     376 B/op	      21 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5523)-8          	  354043	3199 ns/op	    1208 B/op	      36 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5523)_prefilled-8       139259516	8.24 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(5000000)-8         1000000	1396 ns/op	     320 B/op	      19 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5000000)-8              391041	3242 ns/op	    1208 B/op	      36 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5000000)_prefilled-8    148571696	7.92 ns/op	       0 B/op	       0 allocs/op

BenchmarkExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(67280421310721)-8      970454	1550 ns/op	     376 B/op	      21 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(67280421310721)-8           425010	3107 ns/op	    1208 B/op	      36 allocs/op
BenchmarkExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(67280421310721)_prefilled-8 72204832	14.5 ns/op	       0 B/op	       0 allocs/op
All the memory/allocation drops as it nolonger does any work
Unfortunately there is *big* deviation in the time/op part, but I don't
want to take anymore time :)

name                                                                                                                  old time/op    new time/op    delta
ExecutionSegmentScale/seq:;segment:/segment.Scale(5)-8                                                                  8.70ns ±45%    9.77ns ±60%     ~     (p=0.303 n=17+19)
ExecutionSegmentScale/seq:;segment:/et.Scale(5)-8                                                                       1.93µs ±48%    1.34µs ±32%  -30.24%  (p=0.000 n=19+17)
ExecutionSegmentScale/seq:;segment:/et.Scale(5)_prefilled-8                                                             25.2ns ±25%    10.3ns ±54%  -59.07%  (p=0.000 n=19+18)
ExecutionSegmentScale/seq:;segment:/segment.Scale(5523)-8                                                               8.30ns ±43%    8.27ns ±59%     ~     (p=0.983 n=19+19)
ExecutionSegmentScale/seq:;segment:/et.Scale(5523)-8                                                                    2.22µs ±10%    1.37µs ±24%  -38.24%  (p=0.000 n=13+16)
ExecutionSegmentScale/seq:;segment:/et.Scale(5523)_prefilled-8                                                          25.8ns ±47%     9.7ns ±37%  -62.44%  (p=0.000 n=19+18)
ExecutionSegmentScale/seq:;segment:/segment.Scale(5000000)-8                                                            8.74ns ±50%    9.09ns ±31%     ~     (p=0.754 n=20+19)
ExecutionSegmentScale/seq:;segment:/et.Scale(5000000)-8                                                                 2.23µs ±22%    1.32µs ±29%  -40.84%  (p=0.000 n=17+18)
ExecutionSegmentScale/seq:;segment:/et.Scale(5000000)_prefilled-8                                                       27.4ns ±29%    11.0ns ±61%  -59.82%  (p=0.000 n=17+20)
ExecutionSegmentScale/seq:;segment:/segment.Scale(67280421310721)-8                                                     9.49ns ±35%    8.51ns ±28%     ~     (p=0.054 n=20+17)
ExecutionSegmentScale/seq:;segment:/et.Scale(67280421310721)-8                                                          2.14µs ±59%    1.29µs ±40%  -39.77%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:/et.Scale(67280421310721)_prefilled-8                                                25.9ns ±53%    11.2ns ±36%  -56.72%  (p=0.000 n=20+19)
ExecutionSegmentScale/seq:;segment:0:1/segment.Scale(5)-8                                                               2.64µs ±13%    2.52µs ±36%     ~     (p=0.215 n=17+17)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5)-8                                                                    2.42µs ±44%    2.30µs ±34%     ~     (p=0.465 n=20+19)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5)_prefilled-8                                                          24.9ns ±30%    10.3ns ±28%  -58.45%  (p=0.000 n=17+17)
ExecutionSegmentScale/seq:;segment:0:1/segment.Scale(5523)-8                                                            2.13µs ±50%    2.22µs ±55%     ~     (p=0.820 n=20+20)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5523)-8                                                                 2.60µs ±46%    2.00µs ±44%  -23.15%  (p=0.003 n=20+20)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5523)_prefilled-8                                                       27.3ns ±60%    10.0ns ±42%  -63.40%  (p=0.000 n=20+19)
ExecutionSegmentScale/seq:;segment:0:1/segment.Scale(5000000)-8                                                         2.34µs ±53%    2.38µs ±54%     ~     (p=0.738 n=20+20)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5000000)-8                                                              2.58µs ±60%    1.77µs ±47%  -31.63%  (p=0.001 n=19+20)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5000000)_prefilled-8                                                    34.1ns ±37%    10.8ns ±23%  -68.29%  (p=0.000 n=19+18)
ExecutionSegmentScale/seq:;segment:0:1/segment.Scale(67280421310721)-8                                                  2.25µs ±52%    2.46µs ±49%     ~     (p=0.324 n=20+20)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(67280421310721)-8                                                       2.57µs ±55%    1.90µs ±51%  -26.26%  (p=0.001 n=20+20)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(67280421310721)_prefilled-8                                             33.3ns ±26%    10.2ns ±27%  -69.30%  (p=0.000 n=15+18)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(5)-8                                  2.91µs ±35%    2.80µs ±47%     ~     (p=0.749 n=19+20)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5)-8                                       3.72µs ±63%    3.72µs ±34%     ~     (p=0.923 n=20+19)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5)_prefilled-8                             26.3ns ±13%    28.0ns ±56%     ~     (p=0.886 n=17+20)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(5523)-8                               2.56µs ±56%    3.01µs ±30%     ~     (p=0.071 n=20+17)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5523)-8                                    3.42µs ±51%    3.68µs ±46%     ~     (p=0.478 n=19+20)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5523)_prefilled-8                          29.6ns ±34%    25.8ns ±59%     ~     (p=0.304 n=20+20)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(5000000)-8                            2.39µs ±48%    2.83µs ±15%     ~     (p=0.067 n=20+16)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5000000)-8                                 3.48µs ±46%    3.54µs ±30%     ~     (p=0.965 n=20+18)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5000000)_prefilled-8                       26.8ns ±44%    26.8ns ±49%     ~     (p=0.984 n=20+20)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(67280421310721)-8                     2.58µs ±56%    2.98µs ±35%     ~     (p=0.326 n=20+17)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(67280421310721)-8                          3.55µs ±49%    3.98µs ±32%     ~     (p=0.168 n=20+16)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(67280421310721)_prefilled-8                31.1ns ±47%    32.5ns ±37%     ~     (p=0.567 n=19+17)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(5)-8                      2.39µs ±52%    2.72µs ±48%     ~     (p=0.192 n=20+20)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5)-8                           3.72µs ±37%    4.03µs ±38%     ~     (p=0.150 n=18+19)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5)_prefilled-8                 23.4ns ±53%    25.8ns ±54%     ~     (p=0.083 n=18+20)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(5523)-8                   2.14µs ±56%    2.30µs ±57%     ~     (p=0.743 n=20+20)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5523)-8                        3.87µs ±56%    3.83µs ±40%     ~     (p=1.000 n=20+20)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5523)_prefilled-8              24.3ns ±64%    30.7ns ±37%  +26.07%  (p=0.015 n=20+20)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(5000000)-8                2.18µs ±52%    2.04µs ±59%     ~     (p=0.612 n=19+20)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5000000)-8                     4.06µs ±42%    4.21µs ±33%     ~     (p=0.748 n=19+17)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5000000)_prefilled-8           28.4ns ±44%    30.2ns ±59%     ~     (p=0.641 n=19+20)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(67280421310721)-8         2.76µs ±54%    2.55µs ±52%     ~     (p=0.221 n=20+20)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(67280421310721)-8              4.46µs ±42%    4.03µs ±43%     ~     (p=0.314 n=20+20)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(67280421310721)_prefilled-8    33.1ns ±28%    33.8ns ±21%     ~     (p=0.468 n=18+16)
ExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(5)-8                                                           2.95µs ±50%    2.99µs ±52%     ~     (p=0.968 n=20+20)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5)-8                                                                4.41µs ±44%    4.57µs ±52%     ~     (p=0.799 n=20+20)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5)_prefilled-8                                                      23.9ns ±38%    31.4ns ±67%  +31.74%  (p=0.001 n=18+20)
ExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(5523)-8                                                        3.24µs ±46%    3.05µs ±52%     ~     (p=0.414 n=20+20)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5523)-8                                                             4.64µs ±40%    4.50µs ±44%     ~     (p=0.588 n=20+19)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5523)_prefilled-8                                                   26.3ns ±41%    33.2ns ±55%  +26.20%  (p=0.001 n=17+19)
ExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(5000000)-8                                                     3.36µs ±56%    3.26µs ±78%     ~     (p=0.398 n=20+20)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5000000)-8                                                          4.98µs ±38%    4.54µs ±61%     ~     (p=0.301 n=20+20)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5000000)_prefilled-8                                                26.8ns ±55%    26.1ns ±51%     ~     (p=0.878 n=20+20)
ExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(67280421310721)-8                                              3.76µs ±52%    3.77µs ±29%     ~     (p=0.493 n=17+16)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(67280421310721)-8                                                   4.97µs ±35%    4.46µs ±34%  -10.36%  (p=0.042 n=19+18)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(67280421310721)_prefilled-8                                         32.3ns ±68%    28.4ns ±33%     ~     (p=0.080 n=20+20)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(5)-8                                                     3.18µs ±52%    3.24µs ±39%     ~     (p=0.678 n=20+20)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5)-8                                                           729µs ± 4%     723µs ± 2%     ~     (p=0.068 n=20+20)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5)_prefilled-8                                                26.3ns ±25%    30.0ns ±14%  +13.96%  (p=0.001 n=16+19)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(5523)-8                                                  3.89µs ±28%    3.53µs ±49%     ~     (p=0.235 n=19+20)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5523)-8                                                        736µs ± 5%     734µs ± 9%     ~     (p=0.602 n=20+20)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5523)_prefilled-8                                             3.30µs ±16%    2.34µs ±55%  -29.03%  (p=0.000 n=15+20)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(5000000)-8                                               3.37µs ±46%    3.67µs ±45%     ~     (p=0.786 n=20+19)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5000000)-8                                                     739µs ± 4%     735µs ± 6%     ~     (p=0.398 n=20+20)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5000000)_prefilled-8                                          7.72µs ±37%    6.40µs ±31%  -17.10%  (p=0.001 n=20+20)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(67280421310721)-8                                        3.65µs ±44%    3.27µs ±47%     ~     (p=0.242 n=20+20)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(67280421310721)-8                                              740µs ± 4%     726µs ± 6%   -1.83%  (p=0.007 n=20+20)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(67280421310721)_prefilled-8                                   5.49µs ±33%    4.28µs ±45%  -22.11%  (p=0.001 n=19+20)

name                                                                                                                  old alloc/op   new alloc/op   delta
ExecutionSegmentScale/seq:;segment:/segment.Scale(5)-8                                                                   0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:/et.Scale(5)-8                                                                         440B ± 0%      320B ± 0%  -27.27%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:/et.Scale(5)_prefilled-8                                                              0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:/segment.Scale(5523)-8                                                                0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:/et.Scale(5523)-8                                                                      440B ± 0%      320B ± 0%  -27.27%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:/et.Scale(5523)_prefilled-8                                                           0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:/segment.Scale(5000000)-8                                                             0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:/et.Scale(5000000)-8                                                                   440B ± 0%      320B ± 0%  -27.27%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:/et.Scale(5000000)_prefilled-8                                                        0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:/segment.Scale(67280421310721)-8                                                      0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:/et.Scale(67280421310721)-8                                                            440B ± 0%      320B ± 0%  -27.27%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:/et.Scale(67280421310721)_prefilled-8                                                 0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/segment.Scale(5)-8                                                                 320B ± 0%      320B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5)-8                                                                      632B ± 0%      512B ± 0%  -18.99%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5)_prefilled-8                                                           0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/segment.Scale(5523)-8                                                              320B ± 0%      320B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5523)-8                                                                   632B ± 0%      512B ± 0%  -18.99%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5523)_prefilled-8                                                        0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/segment.Scale(5000000)-8                                                           320B ± 0%      320B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5000000)-8                                                                632B ± 0%      512B ± 0%  -18.99%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5000000)_prefilled-8                                                     0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/segment.Scale(67280421310721)-8                                                    320B ± 0%      320B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(67280421310721)-8                                                         632B ± 0%      512B ± 0%  -18.99%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(67280421310721)_prefilled-8                                              0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(5)-8                                    424B ± 0%      424B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5)-8                                       1.06kB ± 0%    1.06kB ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5)_prefilled-8                              0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(5523)-8                                 424B ± 0%      424B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5523)-8                                    1.06kB ± 0%    1.06kB ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5523)_prefilled-8                           0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(5000000)-8                              320B ± 0%      320B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5000000)-8                                 1.06kB ± 0%    1.06kB ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5000000)_prefilled-8                        0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(67280421310721)-8                       376B ± 0%      376B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(67280421310721)-8                          1.06kB ± 0%    1.06kB ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(67280421310721)_prefilled-8                 0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(5)-8                        376B ± 0%      376B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5)-8                           1.21kB ± 0%    1.21kB ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5)_prefilled-8                  0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(5523)-8                     376B ± 0%      376B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5523)-8                        1.21kB ± 0%    1.21kB ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5523)_prefilled-8               0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(5000000)-8                  320B ± 0%      320B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5000000)-8                     1.21kB ± 0%    1.21kB ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5000000)_prefilled-8            0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(67280421310721)-8           376B ± 0%      376B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(67280421310721)-8              1.21kB ± 0%    1.21kB ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(67280421310721)_prefilled-8     0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(5)-8                                                             512B ± 0%      512B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5)-8                                                                1.43kB ± 0%    1.43kB ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5)_prefilled-8                                                       0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(5523)-8                                                          624B ± 0%      624B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5523)-8                                                             1.43kB ± 0%    1.43kB ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5523)_prefilled-8                                                    0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(5000000)-8                                                       512B ± 0%      512B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5000000)-8                                                          1.43kB ± 0%    1.43kB ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5000000)_prefilled-8                                                 0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(67280421310721)-8                                                672B ± 0%      672B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(67280421310721)-8                                                   1.43kB ± 0%    1.43kB ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(67280421310721)_prefilled-8                                          0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(5)-8                                                       568B ± 0%      568B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5)-8                                                           493kB ± 0%     493kB ± 0%     ~     (p=0.592 n=20+20)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5)_prefilled-8                                                 0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(5523)-8                                                    672B ± 0%      672B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5523)-8                                                        493kB ± 0%     493kB ± 0%     ~     (p=0.107 n=20+20)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5523)_prefilled-8                                              0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(5000000)-8                                                 568B ± 0%      568B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5000000)-8                                                     493kB ± 0%     493kB ± 0%   +0.00%  (p=0.001 n=16+20)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5000000)_prefilled-8                                           0.00B          0.00B          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(67280421310721)-8                                          720B ± 0%      720B ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(67280421310721)-8                                              493kB ± 0%     493kB ± 0%     ~     (p=1.081 n=19+20)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(67280421310721)_prefilled-8                                    0.00B          0.00B          ~     (all equal)

name                                                                                                                  old allocs/op  new allocs/op  delta
ExecutionSegmentScale/seq:;segment:/segment.Scale(5)-8                                                                    0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:/et.Scale(5)-8                                                                         17.0 ± 0%      10.0 ± 0%  -41.18%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:/et.Scale(5)_prefilled-8                                                               0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:/segment.Scale(5523)-8                                                                 0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:/et.Scale(5523)-8                                                                      17.0 ± 0%      10.0 ± 0%  -41.18%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:/et.Scale(5523)_prefilled-8                                                            0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:/segment.Scale(5000000)-8                                                              0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:/et.Scale(5000000)-8                                                                   17.0 ± 0%      10.0 ± 0%  -41.18%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:/et.Scale(5000000)_prefilled-8                                                         0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:/segment.Scale(67280421310721)-8                                                       0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:/et.Scale(67280421310721)-8                                                            17.0 ± 0%      10.0 ± 0%  -41.18%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:/et.Scale(67280421310721)_prefilled-8                                                  0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/segment.Scale(5)-8                                                                 19.0 ± 0%      19.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5)-8                                                                      21.0 ± 0%      14.0 ± 0%  -33.33%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5)_prefilled-8                                                            0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/segment.Scale(5523)-8                                                              19.0 ± 0%      19.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5523)-8                                                                   21.0 ± 0%      14.0 ± 0%  -33.33%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5523)_prefilled-8                                                         0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/segment.Scale(5000000)-8                                                           19.0 ± 0%      19.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5000000)-8                                                                21.0 ± 0%      14.0 ± 0%  -33.33%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(5000000)_prefilled-8                                                      0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/segment.Scale(67280421310721)-8                                                    19.0 ± 0%      19.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(67280421310721)-8                                                         21.0 ± 0%      14.0 ± 0%  -33.33%  (p=0.000 n=20+20)
ExecutionSegmentScale/seq:;segment:0:1/et.Scale(67280421310721)_prefilled-8                                               0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(5)-8                                    22.0 ± 0%      22.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5)-8                                         29.0 ± 0%      29.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5)_prefilled-8                               0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(5523)-8                                 22.0 ± 0%      22.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5523)-8                                      29.0 ± 0%      29.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5523)_prefilled-8                            0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(5000000)-8                              19.0 ± 0%      19.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5000000)-8                                   29.0 ± 0%      29.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(5000000)_prefilled-8                         0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/segment.Scale(67280421310721)-8                       21.0 ± 0%      21.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(67280421310721)-8                            29.0 ± 0%      29.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.3,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.3/et.Scale(67280421310721)_prefilled-8                  0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(5)-8                        21.0 ± 0%      21.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5)-8                             36.0 ± 0%      36.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5)_prefilled-8                   0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(5523)-8                     21.0 ± 0%      21.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5523)-8                          36.0 ± 0%      36.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5523)_prefilled-8                0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(5000000)-8                  19.0 ± 0%      19.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5000000)-8                       36.0 ± 0%      36.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(5000000)_prefilled-8             0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/segment.Scale(67280421310721)-8           21.0 ± 0%      21.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(67280421310721)-8                36.0 ± 0%      36.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1;segment:0:0.1/et.Scale(67280421310721)_prefilled-8      0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(5)-8                                                             28.0 ± 0%      28.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5)-8                                                                  42.0 ± 0%      42.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5)_prefilled-8                                                        0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(5523)-8                                                          32.0 ± 0%      32.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5523)-8                                                               42.0 ± 0%      42.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5523)_prefilled-8                                                     0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(5000000)-8                                                       28.0 ± 0%      28.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5000000)-8                                                            42.0 ± 0%      42.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(5000000)_prefilled-8                                                  0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/segment.Scale(67280421310721)-8                                                33.0 ± 0%      33.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(67280421310721)-8                                                     42.0 ± 0%      42.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2/5:4/5/et.Scale(67280421310721)_prefilled-8                                           0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(5)-8                                                       30.0 ± 0%      30.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5)-8                                                            42.0 ± 0%      42.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5)_prefilled-8                                                  0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(5523)-8                                                    33.0 ± 0%      33.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5523)-8                                                         42.0 ± 0%      42.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5523)_prefilled-8                                               0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(5000000)-8                                                 30.0 ± 0%      30.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5000000)-8                                                      42.0 ± 0%      42.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(5000000)_prefilled-8                                            0.00           0.00          ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/segment.Scale(67280421310721)-8                                          34.0 ± 0%      34.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(67280421310721)-8                                               42.0 ± 0%      42.0 ± 0%     ~     (all equal)
ExecutionSegmentScale/seq:;segment:2235/5213:4/5/et.Scale(67280421310721)_prefilled-8                                     0.00           0.00          ~     (all equal)
@mstoykov mstoykov requested review from imiric and na-- April 1, 2020 08:38
// Init values needed for the execution
func (car *ConstantArrivalRate) Init(ctx context.Context) error {
car.et = car.BaseExecutor.executionState.ExecutionTuple.GetNewExecutionTupleBasedOnValue(car.config.MaxVUs.Int64)
// TODO mvoe the preallocation of VUs here ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if by "preallocation" you mean "getting them from the buffer pool in the execution state", then that can't happen here. It needs to be in Run(), because the Init() function of all executors is called before they all start, which, because of the startTime option might not be immediately. Please delete the TODO if that was the intention, it has a typo anyway 😝

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm ... I forgot about the startTime

arrivalRate := getScaledArrivalRate(segment, car.config.Rate.Int64, time.Duration(car.config.TimeUnit.Duration))
preAllocatedVUs := car.config.GetPreAllocatedVUs(car.executionState.ExecutionTuple)
maxVUs := car.config.GetMaxVUs(car.executionState.ExecutionTuple)
arrivalRate := getScaledArrivalRate(car.et.ES, car.config.Rate.Int64, time.Duration(car.config.TimeUnit.Duration))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a future PR, but now this arrivalRate would be used only for the status text, not for the actual execution, so it's becoming a bit confusing... Please add something like a //TODO: refactor and simplify here, since something like this looks more and more appealing for all of the executors: https://github.com/loadimpact/k6/blob/dc46c03ce1a12df30dba8c5b8d103ebc587aaf5e/lib/executor/externally_controlled.go#L366-L369

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I also noticed that now there are like 5 variables which are only used for the progressbar ... But definitely another PR at a later stage

return a
}

type sortInterfaceWrapper struct { // TODO: rename ? delete ? and replace ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can call this "good enough for now", leave the TODOs and refactor it at some later point. We can figure out better names, code structure, and maybe further optimizations once everything else is working, so please add a new low prio + new executors + refactor issue for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1379

I wrote it about the ExecutionTuple as sortInterfaceWrapper, in reality, will probably get removed when we next refactor it and lib.ExecutionTuple is a public type :D

Copy link
Contributor

@imiric imiric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, LGTM.

I can't comment much on the functionality, the math is a bit overwhelming, but as long as it works and it's an improvement we can always refine it later. Nice work!

lib/execution_segment.go Outdated Show resolved Hide resolved
Co-Authored-By: Ivan Mirić <ivan@loadimpact.com>
@mstoykov mstoykov merged commit 6758233 into new-schedulers Apr 1, 2020
@mstoykov mstoykov deleted the GetStripedOffsetsImplementation branch April 1, 2020 13:32
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.

5 participants