Skip to content

Commit

Permalink
dev(performance): use uPlot.join like all other examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Leubeling committed May 19, 2022
1 parent 49f4228 commit d415333
Showing 1 changed file with 7 additions and 22 deletions.
29 changes: 7 additions & 22 deletions demos/multiple_data_normalisation.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,28 +167,13 @@
],
};

const dataHolder = new Normalisation()

performance.mark('map_start');
dataHolder.add(dataset01_s_blue)
dataHolder.add(dataset02_s_red)
dataHolder.add(dataset03_l_green)
dataHolder.add(dataset04_l_yellow)
dataHolder.add(dataset05_sin)
const data = dataHolder.map()
performance.mark('map_end');

performance.mark('join_start');
const data01 = [dataset01_s_blue.map(v => v.time), dataset01_s_blue.map(v => v.value)]
const data02 = [dataset02_s_red.map(v => v.time), dataset02_s_red.map(v => v.value)]
const data03 = [dataset03_l_green.map(v => v.time), dataset03_l_green.map(v => v.value)]
const data04 = [dataset04_l_yellow.map(v => v.time), dataset04_l_yellow.map(v => v.value)]
const data05 = [dataset05_sin.map(v => v.time), dataset05_sin.map(v => v.value)]
const dataJoined = uPlot.join([data01, data02, data03, data04, data05])
performance.mark('join_end');
const r_my = performance.measure("measure map", 'map_start', 'map_end');
const r_join = performance.measure("measure join", 'join_start', 'join_end');
console.log(r_my, r_join, r_my.duration < r_join.duration ? 'map never wins' : 'join is always faster');
const data = uPlot.join([
[dataset01_s_blue.map(v => v.time), dataset01_s_blue.map(v => v.value)],
[dataset02_s_red.map(v => v.time), dataset02_s_red.map(v => v.value)],
[dataset03_l_green.map(v => v.time), dataset03_l_green.map(v => v.value)],
[dataset04_l_yellow.map(v => v.time), dataset04_l_yellow.map(v => v.value)],
[dataset05_sin.map(v => v.time), dataset05_sin.map(v => v.value)]
]);

const plot = new uPlot(opts, data, document.body);

Expand Down

0 comments on commit d415333

Please sign in to comment.