Skip to content

Commit

Permalink
cleanup render to string
Browse files Browse the repository at this point in the history
  • Loading branch information
gnoff committed Apr 8, 2022
1 parent d9fa15a commit f96541e
Showing 1 changed file with 0 additions and 161 deletions.
161 changes: 0 additions & 161 deletions fixtures/fizz/server/render-to-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,168 +25,7 @@ module.exports = function render(url, res) {
'<!DOCTYPE html>' +
renderToString(<App assets={assets} />) +
'<script src="/main.js" async=""></script>';
let start = performance.now();
let arr = textEncoder.encode(payload);
let end = performance.now();
console.log('single block encoding elapsed -- ', end - start);

// let from, increment, parts;

// // --- increment 1
// increment = 1;
// parts = [];
// from = 0;
// for (let i = 0; i < increment; i++) {
// let to = Math.ceil((payload.length / increment) * (i + 1));
// parts.push(payload.slice(from, to));
// from = to;
// }

// start = performance.now();
// for (let i = 0; i < parts.length; i++) {
// let part = parts[i];
// textEncoder.encode(part);
// // Buffer.from(part);
// }
// end = performance.now();
// console.log(`${increment} block encoding elapsed -- ${end - start}`);

// start = performance.now();
// for (let i = 0; i < parts.length; i++) {
// let part = parts[i];
// }
// end = performance.now();
// console.log(`${increment} block no encoding elapsed -- ${end - start}`);

// // --- increment 10
// increment = 10;
// parts = [];
// from = 0;
// for (let i = 0; i < increment; i++) {
// let to = Math.ceil((payload.length / increment) * (i + 1));
// parts.push(payload.slice(from, to));
// from = to;
// }

// start = performance.now();
// for (let i = 0; i < parts.length; i++) {
// let part = parts[i];
// textEncoder.encode(part);
// // Buffer.from(part);
// }
// end = performance.now();
// console.log(`${increment} block encoding elapsed -- ${end - start}`);

// start = performance.now();
// for (let i = 0; i < parts.length; i++) {
// let part = parts[i];
// }
// end = performance.now();
// console.log(`${increment} block no encoding elapsed -- ${end - start}`);

// // --- increment 100
// increment = 100;
// parts = [];
// from = 0;
// for (let i = 0; i < increment; i++) {
// let to = Math.ceil((payload.length / increment) * (i + 1));
// parts.push(payload.slice(from, to));
// from = to;
// }

// start = performance.now();
// for (let i = 0; i < parts.length; i++) {
// let part = parts[i];
// textEncoder.encode(part);
// // Buffer.from(part);
// }
// end = performance.now();
// console.log(`${increment} block encoding elapsed -- ${end - start}`);

// start = performance.now();
// for (let i = 0; i < parts.length; i++) {
// let part = parts[i];
// }
// end = performance.now();
// console.log(`${increment} block no encoding elapsed -- ${end - start}`);

// // --- increment 1,000
// increment = 1000;
// parts = [];
// from = 0;
// for (let i = 0; i < increment; i++) {
// let to = Math.ceil((payload.length / increment) * (i + 1));
// parts.push(payload.slice(from, to));
// from = to;
// }

// start = performance.now();
// for (let i = 0; i < parts.length; i++) {
// let part = parts[i];
// textEncoder.encode(part);
// // Buffer.from(part);
// }
// end = performance.now();
// console.log(`${increment} block encoding elapsed -- ${end - start}`);

// start = performance.now();
// for (let i = 0; i < parts.length; i++) {
// let part = parts[i];
// }
// end = performance.now();
// console.log(`${increment} block no encoding elapsed -- ${end - start}`);

// // --- increment 10,000
// increment = 10000;
// parts = [];
// from = 0;
// for (let i = 0; i < increment; i++) {
// let to = Math.ceil((payload.length / increment) * (i + 1));
// parts.push(payload.slice(from, to));
// from = to;
// }

// start = performance.now();
// for (let i = 0; i < parts.length; i++) {
// let part = parts[i];
// textEncoder.encode(part);
// // Buffer.from(part);
// }
// end = performance.now();
// console.log(`${increment} block encoding elapsed -- ${end - start}`);

// start = performance.now();
// for (let i = 0; i < parts.length; i++) {
// let part = parts[i];
// }
// end = performance.now();
// console.log(`${increment} block no encoding elapsed -- ${end - start}`);

// // --- increment 100,000
// increment = 100000;
// parts = [];
// from = 0;
// for (let i = 0; i < increment; i++) {
// let to = Math.ceil((payload.length / increment) * (i + 1));
// parts.push(payload.slice(from, to));
// from = to;
// }

// start = performance.now();
// for (let i = 0; i < parts.length; i++) {
// let part = parts[i];
// textEncoder.encode(part);
// // Buffer.from(part);
// }
// end = performance.now();
// console.log(`${increment} block encoding elapsed -- ${end - start}`);

// start = performance.now();
// for (let i = 0; i < parts.length; i++) {
// let part = parts[i];
// }
// end = performance.now();
// console.log(`${increment} block no encoding elapsed -- ${end - start}`);

let buf = Buffer.from(arr);
res.statusCode = 200;
Expand Down

0 comments on commit f96541e

Please sign in to comment.